るりまサーチ

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

別のキーワード

  1. tempfile open
  2. tempfile create
  3. tempfile path
  4. tempfile close

クラス

検索結果

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

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

...は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.path).size? #=> 6
//}...