るりまサーチ

最速Rubyリファレンスマニュアル検索!
1708件ヒット [1-100件を表示] (0.300秒)

別のキーワード

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

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

ARGF.class#file -> IO (26142.0)

現在開いている処理対象の File オブジェクト(または IO オブジェ クト)を返します。

...開いている処理対象の File オブジェクト(または IO オブジェ
クト)を返します。

$ echo "foo" > foo
$ echo "bar" > bar

$ ruby argf.rb foo bar

ARGF.file # => #<File:foo>
ARGF.read(5) # => "foo\nb"
ARGF.file # => #<File:bar>

ARGFが現在開いて...

File#lstat -> File::Stat (17148.0)

ファイルの状態を含む File::Stat オブジェクトを生成して返します。 シンボリックリンクに関してリンクそのものの情報を返します。 lstat(2) を実装していないシステムでは、IO#statと同じです。

...ファイルの状態を含む File::Stat オブジェクトを生成して返します。
シンボリックリンクに関してリンクそのものの情報を返します。
lstat(2) を実装していないシステムでは、IO#statと同じです。

@raise Errno::EXXX 失敗した場合...
...ose されている場合に発生します。

//emlist[例][ruby]{
# testlink は testfile のシンボリックリンク
File
.open("testlink") do |f|
p f.lstat == File.stat("testfile") # => false
p f.stat == File.stat("testfile") # => true
end
//}

@see IO#stat, File.stat, File.lstat...

File#flock(operation) -> 0 | false (17121.0)

ファイルをロックします。

...をロックします。

ロックを取得するまでブロックされます。
ロックの取得に成功した場合は 0 を返します。
File
::LOCK_NB (ノンブロッキング) を指定すると、本来ならブロックされる場合に
ブロックされずに false を返すよう...
...eration に有効な定数は以下の通りです。定数は File::Constants で定義されていますが、
File
クラスの親クラスの IO が File::Constants をインクルードしているので、
これらの定数は File::LOCK_SH などとして参照可能です。

: LOCK_SH
...
...ブロックモード。
File
::LOCK_SH | File::LOCK_NB のように他の指定と or することで指
定します。この指定がない場合、ブロックされる条件での flock
の呼び出しはロックが解除されるまでブロックされます。

File
::LOCK_NB の指定が...

File::Stat#file? -> bool (17114.0)

通常ファイルの時に真を返します。

...通常ファイルの時に真を返します。

//emlist[][ruby]{
p File::Stat.new($0).file? #=> true
//}...

File#path -> String (17043.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#to_path -> String (17043.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 -> String (17037.0)

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

...
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::R...
...DWR | File::TMPFILE){|f| f.path } #=> "/tmp"
//}...

File#to_path -> String (17037.0)

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

...
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::R...
...DWR | File::TMPFILE){|f| f.path } #=> "/tmp"
//}...

File#atime -> Time (17031.0)

最終アクセス時刻を Time オブジェクトとして返します。

...に発生します。

@raise Errno::EXXX ファイルの時刻の取得に失敗した場合に発生します。

//emlist[例:][ruby]{
IO.write("testfile", "test")
File
.open("testfile") { |f| f.atime } # => 2017-12-21 22:58:17 +0900
//}

@see File#lstat, File#ctime, File#mtime, File#birthtime...

File#birthtime -> Time (17031.0)

作成された時刻を Time オブジェクトとして返します。

...::EXXX ファイルの時刻の取得に失敗した場合に発生します。

@raise NotImplementedError Windows のような birthtime のない環境で発生します。

File
.new("testfile").birthtime #=> Wed Apr 09 08:53:14 CDT 2003

@see File#lstat, File#atime, File#ctime, File#mtime...

絞り込み条件を変える

File#ctime -> Time (17031.0)

状態が最後に変更された時刻を Time オブジェクトとして返します。状態の変更とは chmod などによるものです。

...に発生します。

@raise Errno::EXXX ファイルの時刻の取得に失敗した場合に発生します。

//emlist[例:][ruby]{
IO.write("testfile", "test")
File
.open("testfile") { |f| f.ctime } # => 2017-12-21 22:58:17 +0900
//}

@see File#lstat, File#atime, File#mtime, File#birthtime...

File#mtime -> Time (17031.0)

最終更新時刻を Time オブジェクトとして返します。

...に発生します。

@raise Errno::EXXX ファイルの時刻の取得に失敗した場合に発生します。

//emlist[例:][ruby]{
IO.write("testfile", "test")
File
.open("testfile") { |f| f.mtime } # => 2017-12-21 22:58:17 +0900
//}

@see File#lstat, File#atime, File#ctime, File#birthtime...
<< 1 2 3 ... > >>