るりまサーチ

最速Rubyリファレンスマニュアル検索!
300件ヒット [201-300件を表示] (0.083秒)
トップページ > クエリ:d[x] > クエリ:instance_method[x] > 種類:インスタンスメソッド[x]

別のキーワード

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

ライブラリ

クラス

検索結果

<< < 1 2 3 >>

UnboundMethod#arity -> Integer (3067.0)

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

...ass C
d
ef one; end
d
ef two(a); end
d
ef three(*a); end
d
ef four(a, b); end
d
ef five(a, b, *c); end
d
ef 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(:fou...
...r).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#==(other) -> bool (3019.0)

自身と 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#eql?(other) -> bool (3019.0)

自身と 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#source_location -> [String, Integer] | nil (3013.0)

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

...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.4.0/time.rb", 654]
//}

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

Method#parameters -> [object] (3007.0)

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

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

Method オブジェクトが引数を取らなければ空の配列を返します。引数を取る場合は、配列の配列を返し、
各配列の要素は引数の種類に応じた以下のような Symbol と、仮引数の名...
...引数

//emlist[例][ruby]{
m = Class.new{define_method(:m){|x, y=42, *other, k_x:, k_y: 42, **k_other, &b|}}.instance_method(:m)
m.parameters #=> x], [:opt, :y], [:rest, :other], [:keyreq, :k_x], [:key, :k_y], [:keyrest, :k_other], [:block, :b
File.method(:symlink).parameters #=> req
//}

@see Pro...

絞り込み条件を変える

UnboundMethod#inspect -> String (3007.0)

self を読みやすい文字列として返します。

...self を読みやすい文字列として返します。

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

//emlist[例][ruby]{
String.instance_method(:count).inspect # => "#<UnboundMethod: String#count>"
//}

@see Method#inspect...

UnboundMethod#name -> Symbol (3007.0)

このメソッドの名前を返します。

...このメソッドの名前を返します。

//emlist[例][ruby]{
a = String.instance_method(:size)
a.name # => :size
//}...

UnboundMethod#original_name -> Symbol (3007.0)

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

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

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

@see Method#original_name...

UnboundMethod#to_s -> String (3007.0)

self を読みやすい文字列として返します。

...self を読みやすい文字列として返します。

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

//emlist[例][ruby]{
String.instance_method(:count).inspect # => "#<UnboundMethod: String#count>"
//}

@see Method#inspect...
<< < 1 2 3 >>