jeudi 5 novembre 2015

Ruby File.open strange behaviour

I found a very strange behaviour of File

[3] pry():1> File.zero?(file.path)
=> true
[4] pry():1> file.size
=> 3894
[5] pry():1> File.zero?(file.path)
=> false

The real file sizes from [3] and [5] can be confirmed by checking them in bash.

Is there an explanation for this behaviour? One thing to mention before is that file.class might be File or Tempfile and it happens in both cases.

Aucun commentaire:

Enregistrer un commentaire