3件ヒット
[1-3件を表示]
(0.096秒)
ライブラリ
- ビルトイン (3)
キーワード
- arity (1)
- hash (1)
-
source
_ location (1)
検索結果
先頭3件
-
Method
# source _ location -> [String , Integer] | nil (628.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
//}... -
Method
# arity -> Integer (610.0) -
メソッドが受け付ける引数の数を返します。
...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).arit... -
Method
# hash -> Integer (610.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
//}...