るりまサーチ

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

別のキーワード

  1. tempfile open
  2. tempfile create
  3. tempfile new
  4. tempfile size
  5. tempfile path

クラス

キーワード

検索結果

File::Stat#<=>(o) -> Integer | nil (27.0)

ファイルの最終更新時刻を比較します。self が other よりも 新しければ正の数を、等しければ 0 を古ければ負の数を返します。 比較できない場合は nil を返します。

...す。

@param o File::Stat のインスタンスを指定します。

//emlist[][ruby]{
require 'tempfile' # for Tempfile

fp1 = Tempfile.open("first")
fp1.print "古い方\n"
sleep(1)
fp2 = Tempfile.open("second")
fp2.print "新しい方\n"

p File::Stat.new(fp1.path) <=> File::Stat.new(fp2.path)...

File::Stat#size? -> Integer | nil (15.0)

サイズが0の時にはnil、それ以外の場合はファイルサイズを返します。

...サイズが0の時にはnil、それ以外の場合はファイルサイズを返します。

//emlist[][ruby]{
require 'tempfile'

fp = Tempfile.new("temp")
p fp.size #=> 0
p File::Stat.new(fp.path).size? #=> nil
fp.print "not 0 "
fp.close
p FileTest.exist?(fp.path) #=> true
p File::Stat.new(fp.p...

IO#fdatasync -> 0 (15.0)

IO のすべてのバッファされているデータを直ちにディスクに書き込みます。

...@raise NotImplementedError fdatasync(2) も fsync(2) も
サポートされていない OS で発生します。

//emlist[例][ruby]{
require "tempfile"

Tempfile
.open("testtmpfile") do |f|
f.print "test"
File.read(f.path) # => ""
f.fdatasync
File.read(f.path) # => "test"
end
//}...

IO#flush -> self (15.0)

IO ポートの内部バッファをフラッシュします。

...ープンされていなければ発生します。

@raise Errno::EXXX fflush(3) が失敗した場合に発生します。

//emlist[例][ruby]{
require "tempfile"

Tempfile
.open("testtmpfile") do |f|
f.print "test"
File.read(f.path) # => ""
f.flush
File.read(f.path) # => "test"
end
//}...