22件ヒット
[1-22件を表示]
(0.052秒)
ライブラリ
- ビルトイン (22)
キーワード
- clone (11)
-
source
_ location (11)
検索結果
-
Method
# clone -> Method (6201.0) -
自身を複製した Method オブジェクトを作成して返します。
...自身を複製した Method オブジェクトを作成して返します。
//emlist[例][ruby]{
class Foo
def foo
"foo"
end
end
m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m.call # => "foo"
m.clone # => #<Method: Foo#foo>
m.clone.call # => "foo"
//}... -
Method
# source _ location -> [String , Integer] | nil (6201.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
//}...