るりまサーチ

最速Rubyリファレンスマニュアル検索!
12件ヒット [1-12件を表示] (0.060秒)
トップページ > クエリ:String[x] > クエリ:ruby[x] > クエリ:string[x] > クエリ:class[x] > 種類:特異メソッド[x] > クラス:File[x]

別のキーワード

  1. string []=
  2. string slice!
  3. string slice
  4. string []
  5. openssl ia5string

ライブラリ

検索結果

File.path(filename) -> String (216.0)

指定されたファイル名を文字列で返します。filename が文字列でない場合は、to_path メソッドを呼びます。

...で返します。filename が文字列でない場合は、to_path メソッドを呼びます。

@param filename ファイル名を表す文字列か to_path メソッドが定義されたオブジェクトを指定します。

//emlist[例][ruby]{
require 'pathname'

class
MyPath
def initiali...
...ze(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"
//}...