るりまサーチ

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

別のキーワード

  1. _builtin absolute_path
  2. pathname absolute?
  3. file absolute_path
  4. uri absolute?
  5. location absolute_path

ライブラリ

キーワード

検索結果

Thread::Backtrace::Location#absolute_path -> String (18125.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 (18119.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...

NEWS for Ruby 2.7.0 (240.0)

NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...p b #=> 1
p c #=> [2, 3]
end

//}

//emlist[][ruby]{
case {a: 0, b: 1}
in {a: 0, x: 1}
:unreachable
in {a: 0, b: var}
p var #=> 1
end

//}

//emlist[][ruby]{
case -1
in 0 then :unreachable
in 1 then :unreachable
end
#=> NoMatchingPatternError
//}

//emlist{
json = <<END
{
"name": "Alice",
"a...
...ge": 30,
"children": [{ "name": "Bob", "age": 2 }]
}
END


JSON.parse(json, symbolize_names: true) in {name: "Alice", children: [{name: name, age: age}]}

p name #=> "Bob"
p age #=> 2

JSON.parse(json, symbolize_names: true) in {name: "Alice", children: [{name: "Charlie", age: age}]}
#=> NoMatchin...
...発生させます。 10344

* File
* 新規メソッド
* パスが絶対パスかどうかをポータブルに判定するFile.absolute_path?メソッドが追加されました。 15868
* 変更されたメソッド
* Windows以外のプラットフォームでFile.extname...

File.path(filename) -> String (24.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 (12.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...

絞り込み条件を変える