44件ヒット
[1-44件を表示]
(0.301秒)
種類
- インスタンスメソッド (33)
- 特異メソッド (11)
ライブラリ
- ビルトイン (44)
クラス
- File (11)
-
RubyVM
:: InstructionSequence (22) -
Thread
:: Backtrace :: Location (11)
検索結果
先頭4件
-
Thread
:: Backtrace :: Location # absolute _ path -> String (26125.0) -
self が表すフレームの絶対パスを返します。
...][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... -
RubyVM
:: InstructionSequence # absolute _ path -> String | nil (26119.0) -
self が表す命令シーケンスの絶対パスを返します。
...>@<compiled>>
iseq.absolute_path
# => nil
例2: RubyVM::InstructionSequence.compile_file を使用した場合
# /tmp/method.rb
def hello
puts "hello, world"
end
# irb
> iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
> iseq.absolute_path # => "/tmp/method.rb... -
File
. path(filename) -> String (8024.0) -
指定されたファイル名を文字列で返します。filename が文字列でない場合は、to_path メソッドを呼びます。
...トを指定します。
//emlist[例][ruby]{
require 'pathname'
class MyPath
def initialize(path)
@path = path
end
def to_path
File.absolute_path(@path)
end
end
File.path("/dev/null") # => "/dev/null"
File.path(Pathname("/tmp")) # => "/tmp"
File.path(MyPath.new("."))... -
RubyVM
:: InstructionSequence # path -> String (8012.0) -
self が表す命令シーケンスの相対パスを返します。
..."<compiled>"
例2: RubyVM::InstructionSequence.compile_file を使用した場合
# /tmp/method.rb
def hello
puts "hello, world"
end
# irb
> iseq = RubyVM::InstructionSequence.compile_file('method.rb')
> iseq.path # => "method.rb"
@see RubyVM::InstructionSequence#absolute_path...