るりまサーチ

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

別のキーワード

  1. matrix l
  2. kernel $-l
  3. _builtin $-l
  4. lupdecomposition l
  5. l matrix

検索結果

<< 1 2 3 > >>

Thread::Backtrace::Location#path -> String (24113.0)

self が表すフレームのファイル名を返します。

...self が表すフレームのファイル名を返します。

例: Thread::Backtrace::Location の例1を用いた例

//emlist[][ruby]{
l
oc = c(0..1).first
l
oc.path # => "caller_locations.rb"
//}

@see Thread::Backtrace::Location#absolute_path...

Thread::Backtrace::Location#absolute_path -> String (15231.0)

self が表すフレームの絶対パスを返します。

...self が表すフレームの絶対パスを返します。

//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end

Foo.new(0..2).locations.map do |call|
puts call.absolute_path
end

# => /path/to/foo.rb
# /path/...
...to/foo.rb
# /path/to/foo.rb
//}

@see Thread::Backtrace::Location#path...

Gem::Specification#full_gem_path -> String (15201.0)

この Gem パッケージへのフルパスを返します。

この Gem パッケージへのフルパスを返します。

Gem::Specification#installation_path -> String (15201.0)

この Gem パッケージのインストール先のパスを返します。

この Gem パッケージのインストール先のパスを返します。

Thread#backtrace_locations(range) -> [Thread::Backtrace::Location] | nil (12412.0)

スレッドの現在のバックトレースを Thread::Backtrace::Location の配 列で返します。

...ースを Thread::Backtrace::Location の配
列で返します。

引数で指定した値が範囲外の場合、スレッドがすでに終了している場合は nil
を返します。

@param start 開始フレームの位置を数値で指定します。

@param length 取得するフレー...
...ます。

Kernel.#caller_locations と似ていますが、本メソッドは self に限定
した情報を返します。

//emlist[例][ruby]{
thread = Thread.new { sleep 1 }
thread.run
thread.backtrace_locations # => ["/path/to/test.rb:1:in `sleep'", "/path/to/test.rb:1:in `block in <main>'"]
/...
.../}

@see Thread::Backtrace::Location...

絞り込み条件を変える

Thread#backtrace_locations(start = 0, length = nil) -> [Thread::Backtrace::Location] | nil (12412.0)

スレッドの現在のバックトレースを Thread::Backtrace::Location の配 列で返します。

...ースを Thread::Backtrace::Location の配
列で返します。

引数で指定した値が範囲外の場合、スレッドがすでに終了している場合は nil
を返します。

@param start 開始フレームの位置を数値で指定します。

@param length 取得するフレー...
...ます。

Kernel.#caller_locations と似ていますが、本メソッドは self に限定
した情報を返します。

//emlist[例][ruby]{
thread = Thread.new { sleep 1 }
thread.run
thread.backtrace_locations # => ["/path/to/test.rb:1:in `sleep'", "/path/to/test.rb:1:in `block in <main>'"]
/...
.../}

@see Thread::Backtrace::Location...

Rake.application -> Rake::Application (12406.0)

現在の Rake アプリケーションを返します。

...//emlist[][ruby]{
# Rakefile での記載例とする

require 'pp'

task default: :test_rake_app
task :test_rake_app do
pp Rake.application
end

# => #<Rake::Application:0x31b0f18
# @default_loader=#<Rake::DefaultLoader:0x31b0c78>,
# @imported=[],
# @last_description=nil,
# @loade...
...ultLoader:0x31b0c18>,
# ".rf"=>#<Rake::DefaultLoader:0x31b0b88>,
# ".rake"=>#<Rake::DefaultLoader:0x31b0b10>},
# @name="rake",
# @options=#<OpenStruct rakelib=["rakelib"], trace_output=#<IO:<STDERR>>>,
# @original_dir="/path/to/dir",
# @pending_imports=[],
# @rakefile...
...akefile",
# @rakefiles=["rakefile", "Rakefile", "rakefile.rb", "Rakefile.rb"],
# @rules=[],
# @scope=LL(),
# @tasks=
# {"default"=><Rake::Task default => [test_rake_app]>,
# "test_rake_app"=><Rake::Task test_rake_app => []>},
# @terminal_columns=0,
# @top_level_tas...

Kernel.#caller_locations(range) -> [Thread::Backtrace::Location] | nil (12306.0)

現在のフレームを Thread::Backtrace::Location の配列で返します。引 数で指定した値が範囲外の場合は nil を返します。

...現在のフレームを Thread::Backtrace::Location の配列で返します。引
数で指定した値が範囲外の場合は nil を返します。

@param start 開始フレームの位置を数値で指定します。

@param length 取得するフレームの個数を指定します。

@pa...
...

//emlist[例][ruby]{
def test1(start, length)
l
ocations = caller_locations(start, length)
p locations
p locations.map(&:lineno)
p locations.map(&:path)
end

def test2(start, length)
test1(start, length)
end

def test3(start, length)
test2(start, length)
end

caller_locations # => []...
...test3(1, nil)
# => ["/Users/user/test.rb:9:in `test2'", "/Users/user/test.rb:13:in `test3'", "/Users/user/test.rb:17:in `<main>'"]
# => [9, 13, 17]
# => ["/Users/user/test.rb", "/Users/user/test.rb", "/Users/user/test.rb"]
test3(1, 2)
# => ["/Users/user/test.rb:9:in `test2'", "/Users/user/test.rb:1...

Kernel.#caller_locations(start = 1, length = nil) -> [Thread::Backtrace::Location] | nil (12306.0)

現在のフレームを Thread::Backtrace::Location の配列で返します。引 数で指定した値が範囲外の場合は nil を返します。

...現在のフレームを Thread::Backtrace::Location の配列で返します。引
数で指定した値が範囲外の場合は nil を返します。

@param start 開始フレームの位置を数値で指定します。

@param length 取得するフレームの個数を指定します。

@pa...
...

//emlist[例][ruby]{
def test1(start, length)
l
ocations = caller_locations(start, length)
p locations
p locations.map(&:lineno)
p locations.map(&:path)
end

def test2(start, length)
test1(start, length)
end

def test3(start, length)
test2(start, length)
end

caller_locations # => []...
...test3(1, nil)
# => ["/Users/user/test.rb:9:in `test2'", "/Users/user/test.rb:13:in `test3'", "/Users/user/test.rb:17:in `<main>'"]
# => [9, 13, 17]
# => ["/Users/user/test.rb", "/Users/user/test.rb", "/Users/user/test.rb"]
test3(1, 2)
# => ["/Users/user/test.rb:9:in `test2'", "/Users/user/test.rb:1...

Proc#source_location -> [String, Integer] | nil (12218.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...

絞り込み条件を変える

<< 1 2 3 > >>