Skip to content

Commit

Permalink
Add UnboundMethod#bind_call since 2.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
znz committed Jun 11, 2020
1 parent c0f4cee commit fda0c79
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions refm/api/src/_builtin/UnboundMethod
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,20 @@ NOTE: Ruby 1.8.xでモジュールのインスタンスメソッドをbindする
end
p m.bind(Bar.new) # => #<Method: Bar(Foo)#foo>

#@since 2.7.0
--- bind_call(recv, *args) -> object
--- bind_call(recv, *args) { ... } -> object

self を recv に bind して args を引数として呼び出します。

self.bind(recv).call(*args) と同じ意味です。

#@samplecode
puts Kernel.instance_method(:inspect).bind_call(BasicObject.new) # => #<BasicObject:0x000055c65e8ea7b8>
#@end

@see [[m:UnboundMethod#bind]], [[m:Method#call]]
#@end
--- arity -> Integer

メソッドが受け付ける引数の数を返します。
Expand Down

0 comments on commit fda0c79

Please sign in to comment.