diff options
author | Jeremy Evans <[email protected]> | 2019-08-21 07:33:28 -0700 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2019-10-26 09:25:11 +0900 |
commit | 00989770535cfe69e618a2c556dad44610042e13 (patch) | |
tree | 65d86caf05626a532611d8f5911d74f79575b6b9 /lib/forwardable.rb | |
parent | d00551a7bb1d5dbabb0a8c95d6bd2d9d4e86934a (diff) |
[ruby/forwardable] Remove string allocation in def_{instance,single}_delegators
https://github.com/ruby/forwardable/commit/1a994c90e1
Diffstat (limited to 'lib/forwardable.rb')
-rw-r--r-- | lib/forwardable.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/forwardable.rb b/lib/forwardable.rb index 3ca8a252dd..924c605c6e 100644 --- a/lib/forwardable.rb +++ b/lib/forwardable.rb @@ -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 |