るりまサーチ

最速Rubyリファレンスマニュアル検索!
2782件ヒット [101-200件を表示] (0.071秒)

別のキーワード

  1. argf.class lines
  2. argf.class each
  3. argf.class each_line
  4. argf.class gets
  5. argf.class to_a

ライブラリ

モジュール

オブジェクト

キーワード

検索結果

<< < 1 2 3 4 ... > >>

Tempfile#open -> self (21107.0)

クローズしたテンポラリファイルを再オープンします。 "r+" でオープンされるので、クローズ前の内容を再度読む ことができます。

...ァイルを再オープンします。
"r+" でオープンされるので、クローズ前の内容を再度読む
ことができます。

require "tempfile"
tf = Tempfile.new("foo")
tf.print("foobar,hoge\n")
tf.print("bar,ugo\n")
tf.close
tf.open
p tf.gets # => "foobar,hoge\n"...

File#path -> String (21060.0)

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

...or 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 (21060.0)

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

...or 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 (21054.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 (21054.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 (21036.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#ctime -> Time (21036.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 (21036.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...

File#atime -> Time (21030.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#chown(owner, group) -> 0 (21030.0)

ファイルのオーナーとグループを変更します。

...ます。

@raise Errno::EXXX 変更に失敗した場合に発生します。

//emlist[例][ruby]{
File.open
("testfile") { |f| f.chown(502, 1000) } # => 0
File
.stat("testfile").uid # => 502
File
.stat("testfile").gid # => 1000
//}

@see File.chown...

絞り込み条件を変える

File#ctime -> Time (21030.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#mtime -> Time (21030.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#size -> Integer (21018.0)

ファイルのサイズを返します。

...ファイルのサイズを返します。

//emlist[例][ruby]{
File.open
("/dev/null") do |f|
f.size #=> 0
end
//}

@raise IOError 自身が close されている場合に発生します。

@raise Errno::EXXX 失敗した場合に発生します。

@see File#lstat...

File#truncate(length) -> 0 (21012.0)

ファイルのサイズを最大 length バイトにします。

...書き込み用にオープンされていなければ発生します。

@raise Errno::EXXX サイズの変更に失敗した場合に発生します。

//emlist[例][ruby]{
IO.write("testfile", "1234567890")
File.open
("testfile", "a") do |f|
f.truncate(5) # => 0
f.size # => 5
end
//}...

Kernel.#open(file, mode_enc = "r", perm = 0666) -> IO (18326.0)

file をオープンして、IO(Fileを含む)クラスのインスタンスを返します。

...
file
をオープンして、IO(Fileを含む)クラスのインスタンスを返します。

ブロックが与えられた場合、指定されたファイルをオープンし、
生成した IO オブジェクトを引数としてブロックを実行します。
ブロックの終了時...
...た結果を返します。

ファイル名 file が `|' で始まる時には続く文字列をコマンドとして起動し、
コマンドの標準入出力に対してパイプラインを生成します

ファイル名が "|-" である時、open は Ruby の子プロセス
を生成し、...
...ェクト)を返し
ます。(このときの動作は、IO.popen と同じです。
File.open
にはパイプラインを生成する機能はありません)。

Perlと異なりコマンドは常に `|' で始まります。

@param file ファイルを文字列で指定します。整数を指...

絞り込み条件を変える

<< < 1 2 3 4 ... > >>