るりまサーチ

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

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

クラス

キーワード

検索結果

Method#source_location -> [String, Integer] | nil (26125.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#inspect -> String (8024.0)

self を読みやすい文字列として返します。

...Method#source_location を表します。
source_location
が nil の場合には付きません。

//emlist[例][ruby]{
module Foo
def foo
"foo"
end
end
class Bar
include Foo
def bar(a, b)
end
end

p Bar.new.method(:foo) # => #<Method: Bar(Foo)#foo() test.rb:2>
p Bar.new.metho...

Method#to_s -> String (8024.0)

self を読みやすい文字列として返します。

...Method#source_location を表します。
source_location
が nil の場合には付きません。

//emlist[例][ruby]{
module Foo
def foo
"foo"
end
end
class Bar
include Foo
def bar(a, b)
end
end

p Bar.new.method(:foo) # => #<Method: Bar(Foo)#foo() test.rb:2>
p Bar.new.metho...