summaryrefslogtreecommitdiff
path: root/lib/pp.rb
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2019-08-30 11:11:55 +0900
committerYusuke Endoh <mame@ruby-lang.org>2019-08-30 11:13:00 +0900
commitc9fc82983ccf624ccec88ffafe6f4e3eb8e7abc4 (patch)
tree08e5c3a539fb32a0d9c4ca5a2b0e1bc1849deb95 /lib/pp.rb
parent09c940b17fcbaec2f7d04e528b8869c8c51ff336 (diff)
lib/pp.rb: Use UnboundMethod#bind_call instead of .bind(obj).call(...)
Related to [Feature #15955].
Diffstat (limited to 'lib/pp.rb')
-rw-r--r--lib/pp.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/pp.rb b/lib/pp.rb
index ef559eff7c..3e17c7ffaf 100644
--- a/lib/pp.rb
+++ b/lib/pp.rb
@@ -89,7 +89,7 @@ class PP < PrettyPrint
# :stopdoc:
def PP.mcall(obj, mod, meth, *args, &block)
- mod.instance_method(meth).bind(obj).call(*args, &block)
+ mod.instance_method(meth).bind_call(obj, *args, &block)
end
# :startdoc:
@@ -174,7 +174,7 @@ class PP < PrettyPrint
# A convenience method, like object_group, but also reformats the Object's
# object_id.
def object_address_group(obj, &block)
- str = Kernel.instance_method(:to_s).bind(obj).call
+ str = Kernel.instance_method(:to_s).bind_call(obj)
str.chomp!('>')
group(1, str, '>', &block)
end
@@ -279,9 +279,9 @@ class PP < PrettyPrint
# This module provides predefined #pretty_print methods for some of
# the most commonly used built-in classes for convenience.
def pretty_print(q)
- method_method = Object.instance_method(:method).bind(self)
+ umethod_method = Object.instance_method(:method)
begin
- inspect_method = method_method.call(:inspect)
+ inspect_method = umethod_method.bind_call(self, :inspect)
rescue NameError
end
if inspect_method && inspect_method.owner != Kernel
@@ -318,7 +318,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 Object.instance_method(:method).bind(self).call(:pretty_print).owner == PP::ObjectMixin
+ if Object.instance_method(:method).bind_call(self, :pretty_print).owner == PP::ObjectMixin
raise "pretty_print is not overridden for #{self.class}"
end
PP.singleline_pp(self, ''.dup)