るりまサーチ (Ruby 2.6.0)

最速Rubyリファレンスマニュアル検索!
4件ヒット [1-4件を表示] (0.028秒)
トップページ > クラス:File[x] > バージョン:2.6.0[x] > クエリ:to_path[x]

別のキーワード

  1. _builtin to_s
  2. openssl to_der
  3. openssl to_s
  4. _builtin to_a
  5. openssl to_pem

ライブラリ

キーワード

検索結果

File#to_path -> String (45307.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 (88.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 (22.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 (7.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?)
//}...