るりまサーチ (Ruby 2.4.0)

最速Rubyリファレンスマニュアル検索!
2件ヒット [1-2件を表示] (0.075秒)
トップページ > バージョン:2.4.0[x] > ライブラリ:ビルトイン[x] > クエリ:_builtin[x] > クエリ:new[x] > クエリ:name[x] > クラス:File[x]

別のキーワード

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

キーワード

検索結果

File.utime(atime, mtime, *filename) -> Integer (24346.0)

ファイルの最終アクセス時刻と更新時刻を変更します。

...秒数を数値で指定します。

@param mtime 更新時刻を Time か、起算時からの経過秒数を数値で指定します。

@param filename ファイル名を表す文字列を指定します。複数指定できます。

@return 変更したファイルの数を返します。

@ra...
...5, 6)
File
.utime(atime, mtime, "testfile") # => 1
File
.atime("testfile") # => 2018-01-02 03:04:05 +0900
File
.mtime("testfile") # => 2018-02-03 04:05:06 +0900
//}

//emlist[例: 経過秒数で指定][ruby]{
File
.utime(1, 2, "testfile") # => 1
File
.atime("testfile")...
...# => 1970-01-01 09:00:01 +0900
File
.mtime("testfile") # => 1970-01-01 09:00:02 +0900
//}...

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