るりまサーチ

最速Rubyリファレンスマニュアル検索!
3件ヒット [1-3件を表示] (0.013秒)
トップページ > クラス:File::Stat[x] > クエリ:size?[x]

関連するキーワード

  1. _builtin
  2. shell
  3. pathname
  4. filetest.#size?

ライブラリ

検索結果

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

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

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

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...