Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

class method

File::Stat.new

(::path file_name) -> ::File::Stat
File::Stat.new(path) → stat

Returns a new File::Stat object containing a snapshot of the filesystem entry at the given path:

Example
File::Stat.new('/etc/passwd')
File::Stat.new('/tmp')
File::Stat.new('nosuch') # Raises Errno::ENOENT: No such file or directory.
See also #<=> #atime also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0