436件ヒット
[1-100件を表示]
(0.035秒)
別のキーワード
種類
- インスタンスメソッド (330)
- 文書 (70)
- モジュール関数 (24)
- クラス (12)
ライブラリ
- ビルトイン (366)
クラス
- Method (83)
- Module (48)
- Object (24)
- Proc (12)
- TracePoint (7)
- UnboundMethod (156)
モジュール
- Marshal (24)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) - == (12)
- === (6)
-
NEWS for Ruby 2
. 0 . 0 (12) -
NEWS for Ruby 2
. 7 . 0 (6) -
NEWS for Ruby 3
. 1 . 0 (4) - [] (6)
- arity (12)
- bind (12)
-
bind
_ call (12) - call (12)
- clone (12)
-
define
_ method (24) -
define
_ singleton _ method (24) - dump (24)
- eql? (12)
- hash (12)
- inspect (24)
-
instance
_ method (12) - name (12)
-
original
_ name (24) - owner (12)
- parameters (19)
-
public
_ instance _ method (12) -
ruby 1
. 6 feature (12) -
ruby 1
. 8 . 4 feature (12) -
ruby 1
. 9 feature (12) -
source
_ location (12) -
super
_ method (11) -
to
_ s (24) - unbind (12)
検索結果
先頭5件
-
UnboundMethod (38030.0)
-
レシーバを持たないメソッドを表すクラスです。 呼び出すためにはレシーバにバインドする必要があります。
...nd により生成し、後で
UnboundMethod#bind によりレシーバを
割り当てた Method オブジェクトを作ることができます。
//emlist[例: Method クラスの冒頭にある例を UnboundMethod で書くと以下のようになります。][ruby]{
class Foo
def foo() "foo......methods[3].bind(Foo.new).call # => "baz"
//}
//emlist[例: 以下はメソッドの再定義を UnboundMethod を使って行う方法です。普通は alias や super を使います。][ruby]{
class Foo
def foo
p :foo
end
@@orig_foo = instance_method :foo
def foo
p :bar... -
UnboundMethod
# clone -> UnboundMethod (21123.0) -
自身を複製した UnboundMethod オブジェクトを作成して返します。
...自身を複製した UnboundMethod オブジェクトを作成して返します。
//emlist[例][ruby]{
a = String.instance_method(:size)
b = a.clone
a == b # => true
//}... -
UnboundMethod
# bind(obj) -> Method (21048.0) -
self を obj にバインドした Method オブジェクトを生成して返します。
...である場合に発生します
//emlist[例][ruby]{
# クラスのインスタンスメソッドの UnboundMethod の場合
class Foo
def foo
"foo"
end
end
# UnboundMethod `m' を生成
p m = Foo.instance_method(:foo) # => #<UnboundMethod: Foo#foo>
# Foo のインスタンスをレシ......ethod: Bar(Foo)#foo>
# モジュールのインスタンスメソッドの UnboundMethod の場合
module Foo
def foo
"foo"
end
end
# UnboundMethod `m' を生成
p m = Foo.instance_method(:foo) # => #<UnboundMethod: Foo#foo>
# Foo をインクルードしたクラス Bar のインスタ......ンスをレシーバと
# する Method オブジェクトを生成
class Bar
include Foo
end
p m.bind(Bar.new) # => #<Method: Bar(Foo)#foo>
//}
@see UnboundMethod#bind_call... -
UnboundMethod
# source _ location -> [String , Integer] | nil (21018.0) -
ソースコードのファイル名と行番号を配列で返します。
... ruby で定義されていない(つまりネイティブ
である)場合は nil を返します。
//emlist[例][ruby]{
require 'time'
Time.instance_method(:zone).source_location # => nil
Time.instance_method(:httpdate).source_location # => ["/Users/user/.rbenv/versions/2.4.3/lib/ruby/2... -
UnboundMethod
# bind _ call(recv , *args) -> object (21012.0) -
self を recv に bind して args を引数として呼び出します。
...self を recv に bind して args を引数として呼び出します。
self.bind(recv).call(*args) と同じ意味です。
//emlist[][ruby]{
puts Kernel.instance_method(:inspect).bind_call(BasicObject.new) # => #<BasicObject:0x000055c65e8ea7b8>
//}
@see UnboundMethod#bind, Method#call... -
UnboundMethod
# bind _ call(recv , *args) { . . . } -> object (21012.0) -
self を recv に bind して args を引数として呼び出します。
...self を recv に bind して args を引数として呼び出します。
self.bind(recv).call(*args) と同じ意味です。
//emlist[][ruby]{
puts Kernel.instance_method(:inspect).bind_call(BasicObject.new) # => #<BasicObject:0x000055c65e8ea7b8>
//}
@see UnboundMethod#bind, Method#call... -
UnboundMethod
# inspect -> String (21012.0) -
self を読みやすい文字列として返します。
...self を読みやすい文字列として返します。
詳しくは Method#inspect を参照してください。
//emlist[例][ruby]{
String.instance_method(:count).inspect # => "#<UnboundMethod: String#count>"
//}
@see Method#inspect... -
UnboundMethod
# to _ s -> String (21012.0) -
self を読みやすい文字列として返します。
...self を読みやすい文字列として返します。
詳しくは Method#inspect を参照してください。
//emlist[例][ruby]{
String.instance_method(:count).inspect # => "#<UnboundMethod: String#count>"
//}
@see Method#inspect... -
UnboundMethod
# ==(other) -> bool (21006.0) -
自身と other が同じクラスあるいは同じモジュールの同じメソッドを表す場合に true を返します。そうでない場合に false を返します。
...。そうでない場合に false を返します。
@param other 自身と比較したいオブジェクトを指定します。
//emlist[例][ruby]{
a = String.instance_method(:size)
b = String.instance_method(:size)
p a == b #=> true
c = Array.instance_method(:size)... -
UnboundMethod
# arity -> Integer (21006.0) -
メソッドが受け付ける引数の数を返します。
...を返します。C 言語レベルで実装されたメソッドが可変長引数を
受け付ける場合、-1 を返します。
//emlist[例][ruby]{
class C
def one; end
def two(a); end
def three(*a); end
def four(a, b); end
def five(a, b, *c); end
def six(a, b, *c, &d); end...