@JRubyMethod(name = {"size", "length"})
@Override
public IRubyObject size(ThreadContext context) {
if (!isClosed()) {
flush(context);
RubyFileStat stat = (RubyFileStat)stat(context);
return stat.size();
} else if (tmpname != null && !tmpname.isNil()) {
RubyFileStat stat = (RubyFileStat)stat(context, getMetaClass(), tmpname);
return stat.size();
} else {
return RubyFixnum.zero(context.runtime);
}
}