るりまサーチ (Ruby 2.3.0)

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

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

クラス

検索結果

Dir#to_path -> String (87622.0)

オープンしているディレクトリのパス名を文字列で返します。

オープンしているディレクトリのパス名を文字列で返します。

//emlist[例][ruby]{
Dir.open("..") do |d|
d.path # => ".."
d.to_path # => ".."
end
//}

File#to_path -> String (87604.0)

オープン時に使用したパスを文字列で返します。

オープン時に使用したパスを文字列で返します。

パスは self に対応するファイルを指しているとは限りません。
たとえば、ファイルが移動されていたり、削除されていたり、
File::Constants::TMPFILEオプション付きで作成されていたりする場合です。

//emlist[例][ruby]{
File.open("testfile") {|f| f.path } #=> "testfile"
File.open("/tmp/../tmp/xxx", "w") {|f| f.path } #=> "/tmp/.....

File.path(filename) -> String (42385.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") ...

Dir#path -> String (42322.0)

オープンしているディレクトリのパス名を文字列で返します。

オープンしているディレクトリのパス名を文字列で返します。

//emlist[例][ruby]{
Dir.open("..") do |d|
d.path # => ".."
d.to_path # => ".."
end
//}

File#path -> String (42304.0)

オープン時に使用したパスを文字列で返します。

オープン時に使用したパスを文字列で返します。

パスは self に対応するファイルを指しているとは限りません。
たとえば、ファイルが移動されていたり、削除されていたり、
File::Constants::TMPFILEオプション付きで作成されていたりする場合です。

//emlist[例][ruby]{
File.open("testfile") {|f| f.path } #=> "testfile"
File.open("/tmp/../tmp/xxx", "w") {|f| f.path } #=> "/tmp/.....

絞り込み条件を変える