mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Refactored using Method#owner.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5f22cfcc30
commit
70ae0d2a42
1 changed files with 2 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue