るりまサーチ

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

別のキーワード

  1. _builtin to_i
  2. fiddle to_i
  3. matrix elements_to_i
  4. csv to_i
  5. kernel $-i

ライブラリ

キーワード

検索結果

Method#arity -> Integer (6432.0)

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

...が可変長引数を受け付ける場合、負の整数

-
(必要とされる引数の数 + 1)

を返します。C 言語レベルで実装されたメソッドが可変長引数を
受け付ける場合、-1 を返します。

//emlist[例][ruby]{
class C
def u; end
def v(a)...
...c.method(:u).arity #=> 0
p c.method(:v).arity #=> 1
p c.method(:w).arity #=> -1
p c.method(:x).arity #=> 2
p c.method(:y).arity #=> -3
p c.method(:z).arity #=> -3

s = "xyz"
s.method(:size).arity #=> 0
s.method(:replace).arity #=> 1
s.method(:squeeze).arity #=> -1
s...
....method(:count).arity #=> -1
//}...

Method#source_location -> [String, Integer] | nil (6408.0)

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

...合は nil を返します。

@see Proc#source_location

//emlist[例][ruby]{
# ------- /tmp/foo.rb ---------
class Foo
def foo; end
end
# ----- end of /tmp/foo.rb ----

require '/tmp/foo'

m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m.source_location # => ["/tmp/foo.rb", 2]

method
(:puts).s...
...ource_location # => nil
//}...

Method#hash -> Integer (402.0)

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

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


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