class method
File.stat
(::string | ::_ToPath file_name) -> ::File::Stat
File.stat(filepath) → stat
file.c
View on GitHub ↗
static VALUE
rb_file_s_stat(VALUE klass, VALUE fname)
{
rb_io_stat_data st;
FilePathValue(fname);
fname = rb_str_encode_ospath(fname);
if (statx_without_gvl(RSTRING_PTR(fname), &st, STATX_ALL) < 0) {
rb_sys_fail_path(fname);
}
return rb_statx_new(&st);
}
Returns a File::Stat object for the file at filepath (see File::Stat):
Example
File.stat('t.txt').class # => File::Stat