種類
- インスタンスメソッド (59)
- 特異メソッド (27)
- 定数 (11)
キーワード
-
absolute
_ path? (5) - join (11)
-
to
_ path (35)
検索結果
先頭5件
-
Pathname
:: TO _ PATH -> Symbol (27202.0) -
内部的に使っている定数です。利用者が使うことはありません。
内部的に使っている定数です。利用者が使うことはありません。 -
File
. path(filename) -> String (18205.0) -
指定されたファイル名を文字列で返します。filename が文字列でない場合は、to_path メソッドを呼びます。
...は、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"
//}... -
IO
# path -> String | nil (18127.0) -
IO に関連付けられたパスを返します。IO がパスに関連付けられていない場合は nil を返します。
...が返すパスがファイルシステム上に存在することは保証されていません。
//emlist[例][ruby]{
p STDIN.path # => "<STDIN>"
p IO.new(IO.sysopen("/")).path # => "/"
p IO.new(IO.sysopen("/"), path: "foo").path # => "foo"
//}... -
Dir
# path -> String (18121.0) -
オープンしているディレクトリのパス名を文字列で返します。
...オープンしているディレクトリのパス名を文字列で返します。
//emlist[例][ruby]{
Dir.open("..") do |d|
d.path # => ".."
d.to_path # => ".."
end
//}... -
File
# path -> String (18121.0) -
オープン時に使用したパスを文字列で返します。
...作成されていたりする場合です。
//emlist[例][ruby]{
File.open("testfile") {|f| f.path } #=> "testfile"
File.open("/tmp/../tmp/xxx", "w") {|f| f.path } #=> "/tmp/../tmp/xxx"
File.open("/tmp", File::RDWR | File::TMPFILE){|f| f.path } #=> "/tmp"
//}......発生します。
//emlist[例][ruby]{
File.open("testfile") {|f| f.path } #=> "testfile"
File.open("/tmp/../tmp/xxx", "w") {|f| f.path } #=> "/tmp/../tmp/xxx"
File.open("/tmp", File::RDWR | File::TMPFILE){|f| f.path } # IOError: File is unnamed (TMPFILE?)
//}... -
Pathname
# to _ path -> String (15202.0) -
File.open などの引数に渡す際に呼ばれるメソッドです。 Pathname オブジェ クトにおいては、 to_s と同じです。
...File.open などの引数に渡す際に呼ばれるメソッドです。 Pathname オブジェ
クトにおいては、 to_s と同じです。
@see Pathname#to_s... -
IO
# to _ path -> String | nil (9227.0) -
IO に関連付けられたパスを返します。IO がパスに関連付けられていない場合は nil を返します。
...が返すパスがファイルシステム上に存在することは保証されていません。
//emlist[例][ruby]{
p STDIN.path # => "<STDIN>"
p IO.new(IO.sysopen("/")).path # => "/"
p IO.new(IO.sysopen("/"), path: "foo").path # => "foo"
//}... -
Dir
# to _ path -> String (9221.0) -
オープンしているディレクトリのパス名を文字列で返します。
...オープンしているディレクトリのパス名を文字列で返します。
//emlist[例][ruby]{
Dir.open("..") do |d|
d.path # => ".."
d.to_path # => ".."
end
//}... -
File
# to _ path -> String (9221.0) -
オープン時に使用したパスを文字列で返します。
...作成されていたりする場合です。
//emlist[例][ruby]{
File.open("testfile") {|f| f.path } #=> "testfile"
File.open("/tmp/../tmp/xxx", "w") {|f| f.path } #=> "/tmp/../tmp/xxx"
File.open("/tmp", File::RDWR | File::TMPFILE){|f| f.path } #=> "/tmp"
//}......発生します。
//emlist[例][ruby]{
File.open("testfile") {|f| f.path } #=> "testfile"
File.open("/tmp/../tmp/xxx", "w") {|f| f.path } #=> "/tmp/../tmp/xxx"
File.open("/tmp", File::RDWR | File::TMPFILE){|f| f.path } # IOError: File is unnamed (TMPFILE?)
//}... -
File
. absolute _ path?(file _ name) -> bool (6155.0) -
file_name が絶対パスなら true を、そうでなければ false を返します。
...合は、to_path メソッド、to_str メソッドの順で暗黙の型変換が試みられます。
@raise TypeError 引数に文字列以外の(暗黙の型変換が行えない)オブジェクトを指定した場合に発生します。
//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?("/foo/bar\\baz") # => false
# プラットフォ......ームが上記以外の場合
File.absolute_path?("C:\\foo\\bar") # => false
File.absolute_path?("/foo/bar\\baz") # => true
//}... -
File
. join(*item) -> String (12.0) -
File::SEPARATORを間に入れて文字列を連結します。platform/DOSISH-supportで環境依存になる予定です。
...に変換されます。
配列・文字列以外のオブジェクトを指定した場合は、まず to_str メソッド、次に to_path メソッドにより暗黙の型変換を試みます。
引数がない場合には空文字列を生成して返します。
@raise...