Skip to content

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

instance method

File::Stat#inspect

() -> ::String
inspect → string

Returns a string representation of the entry in the snapshot in self; here we split the returned strings for readability:

Example
puts File.stat('/etc/passwd').inspect.split(', ')

Output:

#<File::Stat dev=0x10302
ino=11141413
mode=0100644
nlink=1
uid=0
gid=0
rdev=0x0
size=3092
blksize=4096
blocks=8
atime=2026-10-07 11:25:01.307589569 -0500
mtime=2025-06-10 11:10:47.358999941 -0500
ctime=2025-06-10 11:10:47.38899994 -0500>
Example
puts File.stat('/etc').inspect.split(', ')

Output:

#<File::Stat dev=0x10302
ino=11141121
mode=040755
nlink=143
uid=0
gid=0
rdev=0x0
size=12288
blksize=4096
blocks=24
atime=2026-10-04 14:29:46.907775905 -0500
mtime=2026-10-07 06:13:35.116915307 -0500
ctime=2026-10-07 06:13:35.116915307 -0500>
See also #ino #mode #grpowned? #mtime also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0