mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/forwardable] Remove string allocation in def_{instance,single}_delegators
https://github.com/ruby/forwardable/commit/1a994c90e1
This commit is contained in:
parent
d00551a7bb
commit
0098977053
1 changed files with 2 additions and 2 deletions
|
@ -150,7 +150,7 @@ module Forwardable
|
|||
#
|
||||
def def_instance_delegators(accessor, *methods)
|
||||
methods.each do |method|
|
||||
next if method.to_s == "__send__" || method.to_s == "__id__"
|
||||
next if /\A__(?:send|id)__\z/ =~ method
|
||||
def_instance_delegator(accessor, method)
|
||||
end
|
||||
end
|
||||
|
@ -286,7 +286,7 @@ module SingleForwardable
|
|||
#
|
||||
def def_single_delegators(accessor, *methods)
|
||||
methods.each do |method|
|
||||
next if method.to_s == "__send__" || method.to_s == "__id__"
|
||||
next if /\A__(?:send|id)__\z/ =~ method
|
||||
def_single_delegator(accessor, method)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue