diff options
author | Étienne Barrié <etienne.barrie@gmail.com> | 2016-08-30 13:29:07 -0400 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-05-13 11:29:42 +0900 |
commit | 2dc613815d2c4a69bfbcbf78d1b99aa52fbabf60 (patch) | |
tree | 38d501e176f0772c5766284b284d4a9c25d1f3d9 /lib | |
parent | 24964fff92cd89925d2169ad97a357a5bc57e3e1 (diff) | |
download | ruby-2dc613815d2c4a69bfbcbf78d1b99aa52fbabf60.tar.gz |
delegate.rb: don't look for methods on Kernel
Instead, look for instance methods of Kernel.
Otherwise, instance methods of Module (which are methods of Kernel
itself) are mistakenly believed to exist, and it fails when calling
Kernel.instance_method().
Closes: https://github.com/ruby/ruby/pull/1422
Diffstat (limited to 'lib')
-rw-r--r-- | lib/delegate.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/delegate.rb b/lib/delegate.rb index 85c1eb4e4e..9f8ef9d5ad 100644 --- a/lib/delegate.rb +++ b/lib/delegate.rb @@ -81,7 +81,7 @@ class Delegator < BasicObject if r && target.respond_to?(m) target.__send__(m, *args, &block) - elsif ::Kernel.respond_to?(m, true) + elsif ::Kernel.method_defined?(m) || ::Kernel.private_method_defined?(m) ::Kernel.instance_method(m).bind(self).(*args, &block) else super(m, *args, &block) |