るりまサーチ

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

別のキーワード

  1. _builtin puts
  2. csv puts
  3. stringio puts
  4. outputmethod puts
  5. irb/output-method puts

ライブラリ

検索結果

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

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

...クトが ruby で定義されていない(つまりネイティブ
である)場合は 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).source_location # => nil
//}...