1
0
Fork 0
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:
Jeremy Evans 2019-08-21 07:33:28 -07:00 committed by Hiroshi SHIBATA
parent d00551a7bb
commit 0098977053

View file

@ -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