From 9e7b5784180e29b258c99fd36639b5221d427287 Mon Sep 17 00:00:00 2001 From: nagachika Date: Tue, 20 Mar 2018 15:53:38 +0000 Subject: merge revision(s) 58245,60127: [Backport #13973] Refactored using Method#owner. proc.c: super_method of included method * proc.c (method_super_method): search the next super method along the included ancestor chain. [ruby-core:83114] [Bug #13973] * vm_method.c (rb_callable_method_entry_without_refinements): return the defined class. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@62865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/pp.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/pp.rb') diff --git a/lib/pp.rb b/lib/pp.rb index e19edef0ee..7d1c502817 100644 --- a/lib/pp.rb +++ b/lib/pp.rb @@ -311,7 +311,7 @@ class PP < PrettyPrint inspect_method = method_method.call(:inspect) rescue NameError end - if inspect_method && /\(Kernel\)#/ !~ inspect_method.inspect + if inspect_method && inspect_method.owner != Kernel q.text self.inspect elsif !inspect_method && self.respond_to?(:inspect) q.text self.inspect @@ -345,7 +345,7 @@ class PP < PrettyPrint # However, doing this requires that every class that #inspect is called on # implement #pretty_print, or a RuntimeError will be raised. def pretty_print_inspect - if /\(PP::ObjectMixin\)#/ =~ Object.instance_method(:method).bind(self).call(:pretty_print).inspect + if Object.instance_method(:method).bind(self).call(:pretty_print).owner == PP::ObjectMixin raise "pretty_print is not overridden for #{self.class}" end PP.singleline_pp(self, ''.dup) -- cgit v1.2.3