るりまサーチ

最速Rubyリファレンスマニュアル検索!
48件ヒット [1-48件を表示] (0.100秒)

別のキーワード

  1. csv instance
  2. _builtin instance_eval
  3. prime instance
  4. syslog instance
  5. basicobject instance_eval

ライブラリ

キーワード

検索結果

UnboundMethod#owner -> Class | Module (137.0)

このメソッドが定義されている class か module を返します。

...このメソッドが定義されている class か module を返します。

//emlist[例][ruby]{
Integer.instance_method(:to_s).owner # => Integer
Integer.instance_method(:to_c).owner # => Numeric
Integer.instance_method(:hash).owner # => Kernel
//}...

UnboundMethod#arity -> Integer (68.0)

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

...{
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
end

p C.instance_method(:one).arity #=> 0
p C.instance_method(:two).arity #=> 1
p C.instance_method(:three).arity #=> -1
p C.instance_method(...
...:four).arity #=> 2
p C.instance_method(:five).arity #=> -3
p C.instance_method(:six).arity #=> -3


String.instance_method(:size).arity #=> 0
String.instance_method(:replace).arity #=> 1
String.instance_method(:squeeze).arity #=> -1
String.instance_method(:count).arity #=> -1...

UnboundMethod#bind(obj) -> Method (32.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 のインスタンスをレシーバとする Method オ...
...Method
class
Bar < Foo
end
p m.bind(Bar.new) # => #<Method: Bar(Foo)#foo>


# モジュールのインスタンスメソッドの UnboundMethod の場合
module Foo
def foo
"foo"
end
end

# UnboundMethod `m' を生成
p m = Foo.instance_method(:foo) # => #<UnboundMethod: Foo#f...
...oo>

# Foo をインクルードしたクラス Bar のインスタンスをレシーバと
# する Method オブジェクトを生成
class
Bar
include Foo
end
p m.bind(Bar.new) # => #<Method: Bar(Foo)#foo>
//}...
...oo>

# Foo をインクルードしたクラス Bar のインスタンスをレシーバと
# する Method オブジェクトを生成
class
Bar
include Foo
end
p m.bind(Bar.new) # => #<Method: Bar(Foo)#foo>
//}

@see UnboundMethod#bind_call...

UnboundMethod#original_name -> Symbol (14.0)

オリジナルのメソッド名を返します。

...オリジナルのメソッド名を返します。

//emlist[例][ruby]{
class
C
def foo; end
alias bar foo
end
C.instance_method(:bar).original_name # => :foo
//}

@see Method#original_name...