るりまサーチ

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

別のキーワード

  1. openssl integer
  2. asn1 integer
  3. _builtin integer
  4. integer new
  5. integer chr

ライブラリ

キーワード

検索結果

Method#arity -> Integer (108.0)

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

...end

c = C.new
p 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 (108.0)

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

...@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).source_location # => nil
//}...