Hi,
In message "[ruby-talk:5264] Re: problem: undefined method `size' for Fil e"
on 00/10/04, Aleksi Niemel<aleksi.niemela / cinnober.com> writes:
|matz critizes good solution argumenting with features lacking from some
|widely available programming language:
which implements Ruby interpreter. ;-)
|Humm..how about:
|
| class File
| def size
| FileTest.size(self.path)
| end
| end
|
| p File.new("file_size.rb").size
As Guy pointed out, things is not that simple. Probably
class File
def size
self.flush
self.stat.size
end
end
is better. But I'm not sure whether this works for all cases.
matz.