From fda0c7973ed35ab120113ac5d25da601b77349b0 Mon Sep 17 00:00:00 2001 From: Kazuhiro NISHIYAMA Date: Thu, 11 Jun 2020 19:10:37 +0900 Subject: [PATCH 1/2] Add UnboundMethod#bind_call since 2.7.0 --- refm/api/src/_builtin/UnboundMethod | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/refm/api/src/_builtin/UnboundMethod b/refm/api/src/_builtin/UnboundMethod index 50f9d81380..8f46dd0d23 100644 --- a/refm/api/src/_builtin/UnboundMethod +++ b/refm/api/src/_builtin/UnboundMethod @@ -99,6 +99,20 @@ NOTE: Ruby 1.8.xでモジュールのインスタンスメソッドをbindする end p m.bind(Bar.new) # => # +#@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) # => # +#@end + +@see [[m:UnboundMethod#bind]], [[m:Method#call]] +#@end --- arity -> Integer メソッドが受け付ける引数の数を返します。 From 46441ed2703d4a196c11284d4aab66d19ecea7e5 Mon Sep 17 00:00:00 2001 From: Kazuhiro NISHIYAMA Date: Tue, 16 Jun 2020 20:08:48 +0900 Subject: [PATCH 2/2] Add reverse links --- refm/api/src/_builtin/Method | 3 +++ refm/api/src/_builtin/UnboundMethod | 1 + 2 files changed, 4 insertions(+) diff --git a/refm/api/src/_builtin/Method b/refm/api/src/_builtin/Method index 1f9854703e..532dffc243 100644 --- a/refm/api/src/_builtin/Method +++ b/refm/api/src/_builtin/Method @@ -118,6 +118,9 @@ self[] の形の呼び出しは通常のメソッド呼び出しに見た目を @param args self に渡される引数。 +#@since 2.7.0 +@see [[m:UnboundMethod#bind_call]] +#@end @see [[d:spec/safelevel]] #@# セーフレベルに関するその他の詳細 diff --git a/refm/api/src/_builtin/UnboundMethod b/refm/api/src/_builtin/UnboundMethod index 8f46dd0d23..91c3e5cd86 100644 --- a/refm/api/src/_builtin/UnboundMethod +++ b/refm/api/src/_builtin/UnboundMethod @@ -100,6 +100,7 @@ NOTE: Ruby 1.8.xでモジュールのインスタンスメソッドをbindする p m.bind(Bar.new) # => # #@since 2.7.0 +@see [[m:UnboundMethod#bind_call]] --- bind_call(recv, *args) -> object --- bind_call(recv, *args) { ... } -> object