4件ヒット
[1-4件を表示]
(0.256秒)
種類
- 特異メソッド (2)
- インスタンスメソッド (2)
検索結果
先頭4件
-
File
# to _ path -> String (69619.0) -
オープン時に使用したパスを文字列で返します。
...Error TMPFILE File::Constants::TMPFILEオプション付きで作成されている場合に発生します。
//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
. path(filename) -> String (24397.0) -
指定されたファイル名を文字列で返します。filename が文字列でない場合は、to_path メソッドを呼びます。
...指定されたファイル名を文字列で返します。filename が文字列でない場合は、to_path メソッドを呼びます。
@param filename ファイル名を表す文字列か to_path メソッドが定義されたオブジェクトを指定します。
//emlist[例][ruby]{
requ......ire '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"
//}... -
File
. join(*item) -> String (24331.0) -
File::SEPARATORを間に入れて文字列を連結します。platform/DOSISH-supportで環境依存になる予定です。
...
File::SEPARATORを間に入れて文字列を連結します。platform/DOSISH-supportで環境依存になる予定です。
@param item 連結したいディレクトリ名やファイル名を文字列(もしくは文字列を要素に持つ配列)で与えます。
文字列A......とBを連結する際に、Aの末尾の文字とBの先頭の文字がFile::SEPARATORであった場合には、
まずこれらを削除した上で改めてFile::SEPARATORを間に入れて連結します。
引数の中に配列がある場合は配列要素を再帰的......t[例][ruby]{
File.join("a","b") # => "a/b"
File.join("a/","b") # => "a/b"
File.join("a/","/b") # => "a/b"
File.join("a","/b") # => "a/b"
File.join("a", ["b", ["c", ["d"]]]) # => "a/b/c/d"
File.join("", "a"... -
File
# path -> String (24319.0) -
オープン時に使用したパスを文字列で返します。
...Error TMPFILE File::Constants::TMPFILEオプション付きで作成されている場合に発生します。
//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?)
//}...