るりまサーチ

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

別のキーワード

  1. _builtin file?
  2. _builtin file
  3. file path
  4. file lstat
  5. file truncate

ライブラリ

クラス

キーワード

検索結果

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

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

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

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

File
.expand_path と異なり、 file_name 先頭が "~" である場...
...t[例][ruby]{
p Dir.getwd #=> "/home/matz/work/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.absolut...
...e_path("~foo") #=> "/home/matz/work/bar/~foo"
//}

@see File.expand_path...

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

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

...structionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.absolute_path
# => nil

例2: RubyVM::InstructionSequence.compile_file を使用した場合

# /tmp/method.rb
def hello
puts "hello, world"
end

# irb
> iseq = RubyVM::Instruct...
...ionSequence.compile_file('/tmp/method.rb')
> iseq.absolute_path # => "/tmp/method.rb"

@see RubyVM::InstructionSequence#path...

File.absolute_path?(file_name) -> bool (21408.0)

file_name が絶対パスなら true を、そうでなければ false を返します。

...
file
_name が絶対パスなら true を、そうでなければ false を返します。

@param file_name ファイル名を表す文字列を指定します。文字列でない場合は、to_path メソッド、to_str メソッドの順で暗黙の型変換が試みられます。

@raise TypeE...
...emlist[例][ruby]{
File
.absolute_path?("//foo/bar\\baz") # => true
File
.absolute_path?("C:foo\\bar") # => false
File
.absolute_path?("~") # => false

# プラットフォームが cygwin、mswin、mingw の場合
File
.absolute_path?("C:\\foo\\bar") # => true
File
.absolute_path?("/f...
...oo/bar\\baz") # => false

# プラットフォームが上記以外の場合
File
.absolute_path?("C:\\foo\\bar") # => false
File
.absolute_path?("/foo/bar\\baz") # => true
//}...

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

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

...structionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.path
# => "<compiled>"

例2: RubyVM::InstructionSequence.compile_file を使用した場合

# /tmp/method.rb
def hello
puts "hello, world"
end

# irb
> iseq = RubyVM::Instruct...
...ionSequence.compile_file('method.rb')
> iseq.path # => "method.rb"

@see RubyVM::InstructionSequence#absolute_path...

絞り込み条件を変える

NEWS for Ruby 2.0.0 (66.0)

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

...ーディングを US-ASCII から UTF-8 に変更しました
* '_' で始まる使用されていない変数は警告しなくなりました

=== 組み込みクラスの更新

* ARGF.class
* 追加: ARGF.class#codepoints, ARGF.class#each_codepoint
IO にある同名のメソッ...
...tor::Lazy 遅延列挙用のクラス

* ENV
* ENV.to_h は ENV.to_hash へのエイリアスです

* Fiber
* 非互換: Fiber#resume は Fiber#transfer を呼び出したファイバーを再開できなくなりました

* File
* 拡張: File.fnmatch? は File::FNM_EXTGLOB(File...
...::InstructionSequence.of to 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::InstructionSe...