るりまサーチ

最速Rubyリファレンスマニュアル検索!
130件ヒット [1-100件を表示] (0.124秒)
トップページ > クエリ:-[x] > クエリ:r[x] > クラス:UnboundMethod[x]

別のキーワード

  1. _builtin -
  2. open-uri open
  3. irb/input-method new
  4. irb/input-method gets
  5. matrix -

ライブラリ

キーワード

検索結果

<< 1 2 > >>

UnboundMethod#arity -> Integer (6231.0)

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

...負の整数
-
(必要とされる引数の数 + 1)
を返します。C 言語レベルで実装されたメソッドが可変長引数を
受け付ける場合、-1 を返します。

//emlist[例][ruby]{
class C
def one; end
def two(a); end
def three(*a); end
def four(a, b); end
de...
...od(: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.instan...
...ce_method(:replace).arity #=> 1
String.instance_method(:squeeze).arity #=> -1
String.instance_method(:count).arity #=> -1
//}...

UnboundMethod#original_name -> Symbol (6201.0)

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

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

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

@see Method#original_name...

UnboundMethod#owner -> Class | Module (6201.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#parameters -> [object] (6201.0)

UnboundMethod オブジェクトの引数の情報を返します。

...
UnboundMethod
オブジェクトの引数の情報を返します。

詳しくは Method#parameters を参照してください。



@see Proc#parameters, Method#parameters...

UnboundMethod#source_location -> [String, Integer] | nil (6201.0)

ソースコードのファイル名と行番号を配列で返します。

... ruby で定義されていない(つまりネイティブ
である)場合は nil を返します。

//emlist[例][ruby]{
r
equire 'time'

Time.instance_method(:zone).source_location # => nil
Time.instance_method(:httpdate).source_location # => ["/Users/user/.rbenv/versions/2.4.3/lib/rub...
...y/2.4.0/time.rb", 654]
//}

@see Proc#source_location, Method#source_location...

絞り込み条件を変える

UnboundMethod#super_method -> UnboundMethod | nil (6201.0)

self 内で super を実行した際に実行されるメソッドを UnboundMethod オブジェ クトにして返します。

...self 内で super を実行した際に実行されるメソッドを UnboundMethod オブジェ
クトにして返します。


@see Method#super_method...

UnboundMethod#==(other) -> bool (201.0)

自身と other が同じクラスあるいは同じモジュールの同じメソッドを表す場合に true を返します。そうでない場合に false を返します。

...自身と other が同じクラスあるいは同じモジュールの同じメソッドを表す場合に
true を返します。そうでない場合に false を返します。

@param other 自身と比較したいオブジェクトを指定します。

//emlist[例][ruby]{
a = String.instance_...
...method(:size)
b = String.instance_method(:size)
p a == b #=> true

c = Array.instance_method(:size)
p a == c #=> false
//}...

UnboundMethod#bind_call(recv, *args) -> object (201.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 (201.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#eql?(other) -> bool (201.0)

自身と other が同じクラスあるいは同じモジュールの同じメソッドを表す場合に true を返します。そうでない場合に false を返します。

...自身と other が同じクラスあるいは同じモジュールの同じメソッドを表す場合に
true を返します。そうでない場合に false を返します。

@param other 自身と比較したいオブジェクトを指定します。

//emlist[例][ruby]{
a = String.instance_...
...method(:size)
b = String.instance_method(:size)
p a == b #=> true

c = Array.instance_method(:size)
p a == c #=> false
//}...

絞り込み条件を変える

UnboundMethod#hash -> Integer (201.0)

自身のハッシュ値を返します。

...自身のハッシュ値を返します。


//emlist[例][ruby]{
a = method(:==).unbind
b = method(:eql?).unbind
p a.eql? b # => true
p a.hash == b.hash # => true
p [a, b].uniq.size # => 1
//}...
<< 1 2 > >>