るりまサーチ

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

別のキーワード

  1. rss source
  2. _builtin source_location
  3. _builtin source_encoding
  4. socket ip_block_source
  5. socket mcast_block_source

ライブラリ

クラス

検索結果

Proc#source_location -> [String, Integer] | nil (24231.0)

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

...nil を返します。


//emlist[例][ruby]{
# /path/to/target.rb を実行
proc {}.source_location # => ["/path/to/target.rb", 1]
proc {}.source_location # => ["/path/to/target.rb", 2]
(eval "proc {}").source_location # => ["(eval)", 1]
method(:p).to_proc.source_location #...
...=> nil
//}

@see Method#source_location...

UnboundMethod#source_location -> [String, Integer] | nil (24225.0)

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

...nil を返します。

//emlist[例][ruby]{
require 'time'

Time.instance_method(:zone).source_location # => nil
Time.instance_method(:httpdate).source_location # => ["/Users/user/.rbenv/versions/2.4.3/lib/ruby/2.4.0/time.rb", 654]
//}

@see Proc#source_location, Method#source_location...

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

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

...il を返します。

@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_lo...
...cation # => nil
//}...

Binding#source_location -> [String, Integer] (24207.0)

self の Ruby のソースファイル名と行番号を返します。

...self の Ruby のソースファイル名と行番号を返します。

d:spec/variables#pseudo の __FILE__ と __LINE__ も参照してください。

//emlist[例][ruby]{
p binding.source_location # => ["test.rb", 1]
//}...

Module#const_source_location(name, inherited = true) -> [String, Integer] (12267.0)

name で指定した定数の定義を含むソースコードのファイル名と行番号を配列で返します。

...号を配列で返します。

@param name Symbol,String で定数の名前を指定します。
@param inherited true を指定するとスーパークラスや include したモジュールで定義された定数が対象にはなります。false を指定した場合 対象にはなりませ...
...nil を返します。
定数は見つかったがソースファイルが見つからなかった場合は空の配列を返します。

//emlist[例][ruby]{
# test.rb:
class A # line 1
C1 = 1
C2 = 2
end

module M # line 6
C3 = 3
end

class B < A # line 10
includ...
...class A # 継続して A を定義する
C2 = 8 # 定数を再定義する
end

p B.const_source_location('C4') # => ["test.rb", 12]
p B.const_source_location('C3') # => ["test.rb", 7]
p B.const_source_location('C1') # => ["test.rb", 2]

p B.const_source_location('C...

絞り込み条件を変える