るりまサーチ

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

別のキーワード

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

検索結果

File.absolute_path(file_name, dir_string=nil) -> String (18333.0)

file_name を絶対パスに変換した文字列を返します。

...name を絶対パスに変換した文字列を返します。

相対パスの場合はカレントディレクトリを基準とします。
dir_string を渡した場合はそのディレクトリを基準とします。

File.expand_path と異なり、 file_name 先頭が "~" である場合...
...bar"
p ENV["HOME"] #=> "/home/matz"
p File.absolute_path("..") #=> "/home/matz/work"
p File.absolute_path("..", "/tmp") #=> "/"
p File.absolute_path("~") #=> "/home/matz/work/bar/~"
p File.absolute_path("~foo") #=> "/home/matz/work/bar/~foo"
//}

@see File.e...

RubyVM::InstructionSequence#absolute_path -> String | nil (18214.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...

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

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

絞り込み条件を変える

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

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

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

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

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

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

NEWS for Ruby 2.0.0 (78.0)

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

...get the instruction sequence
from a method or a block.
* 追加: RubyVM::InstructionSequence#path,
RubyVM::InstructionSequence#absolute_path,
RubyVM::InstructionSequence#label,
RubyVM::InstructionSequence#base_label,
RubyVM::InstructionSequence#first_lineno to retr...
...* String
* 追加: String#b エンコーディングを ASCII-8BIT に設定したコピーされた文字列を返します
* 返り値変更:
* String#lines Enumerator ではなく Array を返します
* String#chars Enumerator ではなく Array を返します
* String...
...#codepoints Enumerator ではなく Array を返します
* String#bytes Enumerator ではなく Array を返します

* Struct
* 追加: Struct#to_h インスタンス変数の名前と値をハッシュのキーと値にしたハッシュを生成して返します

* Thread
*...

NEWS for Ruby 2.7.0 (60.0)

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

...)

where(sales: ..100)
//}

* 「$;」にnil以外の値を設定すると警告が出るようになりました。 14240
nil以外の時はString#splitで参照した時も警告が出ます。
この警告は「-W:no-deprecated」オプションで止められます。

* 「$,」にn...
...発生させます。 10344

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

* NilClass / TrueClass / FalseClass
* 変更されたメソッド
* NilClass#to_s, TrueClass#to_s, FalseClass#to_sが
常にfreezeされたStringを返すようになりまし...