るりまサーチ

最速Rubyリファレンスマニュアル検索!
12件ヒット [1-12件を表示] (0.099秒)
トップページ > 種類:インスタンスメソッド[x] > クエリ:Integer[x] > クエリ:method[x] > クラス:Method[x] > クエリ:source_location[x]

別のキーワード

  1. irb/input-method gets
  2. _builtin define_method
  3. irb/input-method new
  4. irb/input-method encoding
  5. irb/input-method readable_atfer_eof?

ライブラリ

検索結果

Method#source_location -> [String, Integer] | nil (27240.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
//}...