るりまサーチ

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

別のキーワード

  1. _builtin end
  2. ripper end_seen?
  3. _builtin exclude_end?
  4. _builtin end_with?
  5. range exclude_end?

ライブラリ

キーワード

検索結果

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

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

...mlist[例][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::Locatio...

RubyVM::InstructionSequence#absolute_path -> String | nil (21219.0)

self が表す命令シーケンスの絶対パスを返します。

...していた場合は nil を返します。

例1:irb で実行した場合

i
seq = RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
i
seq.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"

@see RubyVM::InstructionSequence#path...

File.path(filename) -> String (3124.0)

指定されたファイル名を文字列で返します。filename が文字列でない場合は、to_path メソッドを呼びます。

...ます。filename が文字列でない場合は、to_path メソッドを呼びます。

@param 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(".")) # => "/Users/user/projects/txt"
//}...

RubyVM::InstructionSequence#path -> String (3112.0)

self が表す命令シーケンスの相対パスを返します。

...いた
場合は "<compiled>" を返します。

例1:irb で実行した場合

i
seq = RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
i
seq.path
# => "<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...

NEWS for Ruby 2.7.0 (246.0)

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

...ルか bugs.ruby-lang.org の issue を参照してください。

== 2.6.0 以降の変更

=== 言語仕様の変更

==== パターンマッチ

* パターンマッチが実験的機能として導入されました。 14912

//emlist[][ruby]{
case [0, [1, 2, 3]]
i
n [a, [b, *c]]
p a #=> 0...
...nd
//}

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

//}

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

//emlist{
json = <<END
{
"name": "Alice",
"age": 30,
"children": [{ "n...
...iber
* 新規メソッド
* Fiber#raiseメソッドが追加され、Fiber#resumeのように
resumeして、さらに例外を発生させます。 10344

* File
* 新規メソッド
* パスが絶対パスかどうかをポータブルに判定するFile.absolute_path...

絞り込み条件を変える