84件ヒット
[1-84件を表示]
(0.036秒)
検索結果
先頭5件
-
Dir
# to _ path -> String (15113.0) -
オープンしているディレクトリのパス名を文字列で返します。
...オープンしているディレクトリのパス名を文字列で返します。
//emlist[例][ruby]{
Dir.open("..") do |d|
d.path # => ".."
d.to_path # => ".."
end
//}... -
File
# to _ path -> String (15107.0) -
オープン時に使用したパスを文字列で返します。
...たり、削除されていたり、
File::Constants::TMPFILEオプション付きで作成されていたりする場合です。
//emlist[例][ruby]{
File.open("testfile") {|f| f.path } #=> "testfile"
File.open("/tmp/../tmp/xxx", "w") {|f| f.path } #=> "/tmp/../t......です。
@raise IOError TMPFILE File::Constants::TMPFILEオプション付きで作成されている場合に発生します。
//emlist[例][ruby]{
File.open("testfile") {|f| f.path } #=> "testfile"
File.open("/tmp/../tmp/xxx", "w") {|f| f.path } #=> "/tmp/../t... -
IO
# to _ path -> String | nil (15107.0) -
IO に関連付けられたパスを返します。IO がパスに関連付けられていない場合は nil を返します。
...します。
このメソッドが返すパスがファイルシステム上に存在することは保証されていません。
//emlist[例][ruby]{
p STDIN.path # => "<STDIN>"
p IO.new(IO.sysopen("/")).path # => "/"
p IO.new(IO.sysopen("/"), path:... -
File
. path(filename) -> String (34.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... -
Dir
# path -> String (13.0) -
オープンしているディレクトリのパス名を文字列で返します。
...オープンしているディレクトリのパス名を文字列で返します。
//emlist[例][ruby]{
Dir.open("..") do |d|
d.path # => ".."
d.to_path # => ".."
end
//}... -
File
. absolute _ path?(file _ name) -> bool (12.0) -
file_name が絶対パスなら true を、そうでなければ false を返します。
...でない場合は、to_path メソッド、to_str メソッドの順で暗黙の型変換が試みられます。
@raise TypeError 引数に文字列以外の(暗黙の型変換が行えない)オブジェクトを指定した場合に発生します。
//emlist[例][ruby]{
File.absolute_path... -
File
. join(*item) -> String (12.0) -
File::SEPARATORを間に入れて文字列を連結します。platform/DOSISH-supportで環境依存になる予定です。
...に変換されます。
配列・文字列以外のオブジェクトを指定した場合は、まず to_str メソッド、次に to_path メソッドにより暗黙の型変換を試みます。
引数がない場合には空文字列を生成して返します。
@raise......限にネストした配列や、
ヌル文字を含む文字列が存在した場合に発生します。
//emlist[例][ruby]{
File.join("a","b") # => "a/b"
File.join("a/","b") # => "a/b"
File.join("a/","/b")... -
File
# path -> String (7.0) -
オープン時に使用したパスを文字列で返します。
...たり、削除されていたり、
File::Constants::TMPFILEオプション付きで作成されていたりする場合です。
//emlist[例][ruby]{
File.open("testfile") {|f| f.path } #=> "testfile"
File.open("/tmp/../tmp/xxx", "w") {|f| f.path } #=> "/tmp/../t......です。
@raise IOError TMPFILE File::Constants::TMPFILEオプション付きで作成されている場合に発生します。
//emlist[例][ruby]{
File.open("testfile") {|f| f.path } #=> "testfile"
File.open("/tmp/../tmp/xxx", "w") {|f| f.path } #=> "/tmp/../t... -
IO
# path -> String | nil (7.0) -
IO に関連付けられたパスを返します。IO がパスに関連付けられていない場合は nil を返します。
...します。
このメソッドが返すパスがファイルシステム上に存在することは保証されていません。
//emlist[例][ruby]{
p STDIN.path # => "<STDIN>"
p IO.new(IO.sysopen("/")).path # => "/"
p IO.new(IO.sysopen("/"), path:...