# File::Stat (Class)

In: | pp.rb
Parent: | Object

## Methods

pretty_print

## Public Instance methods

pretty_print(pp)

[Source]

    # File pp.rb, line 343
        def pretty_print(pp)
          require 'etc.so'
          pp.object_group(self) {
            pp.breakable
            pp.text sprintf("dev=0x%x", self.dev); pp.comma_breakable
            pp.text "ino="; pp.pp self.ino; pp.comma_breakable
            pp.group {
              m = self.mode
              pp.text sprintf("mode=0%o", m)
              pp.breakable
              pp.text sprintf("(%s %c%c%c%c%c%c%c%c%c)",
                self.ftype,
                (m & 0400 == 0 ? ?- : ?r),
                (m & 0200 == 0 ? ?- : ?w),
                (m & 0100 == 0 ? (m & 04000 == 0 ? ?- : ?S) :
                                 (m & 04000 == 0 ? ?x : ?s)),
                (m & 0040 == 0 ? ?- : ?r),
                (m & 0020 == 0 ? ?- : ?w),
                (m & 0010 == 0 ? (m & 02000 == 0 ? ?- : ?S) :
                                 (m & 02000 == 0 ? ?x : ?s)),
                (m & 0004 == 0 ? ?- : ?r),
                (m & 0002 == 0 ? ?- : ?w),
                (m & 0001 == 0 ? (m & 01000 == 0 ? ?- : ?T) :
                                 (m & 01000 == 0 ? ?x : ?t)))
            }
            pp.comma_breakable
            pp.text "nlink="; pp.pp self.nlink; pp.comma_breakable
            pp.group {
              pp.text "uid="; pp.pp self.uid
              begin
                name = Etc.getpwuid(self.uid).name
                pp.breakable; pp.text "(#{name})"
              rescue ArgumentError
              end
            }
            pp.comma_breakable
            pp.group {
              pp.text "gid="; pp.pp self.gid
              begin
                name = Etc.getgrgid(self.gid).name
                pp.breakable; pp.text "(#{name})"
              rescue ArgumentError
              end
            }
            pp.comma_breakable
            pp.group {
              pp.text sprintf("rdev=0x%x", self.rdev)
              pp.breakable
              pp.text sprintf('(%d, %d)', self.rdev_major, self.rdev_minor)
            }
            pp.comma_breakable
            pp.text "size="; pp.pp self.size; pp.comma_breakable
            pp.text "blksize="; pp.pp self.blksize; pp.comma_breakable
            pp.text "blocks="; pp.pp self.blocks; pp.comma_breakable
            pp.group {
              t = self.atime
              pp.text "atime="; pp.pp t
              pp.breakable; pp.text "(#{t.tv_sec})"
            }
            pp.comma_breakable
            pp.group {
              t = self.mtime
              pp.text "mtime="; pp.pp t
              pp.breakable; pp.text "(#{t.tv_sec})"
            }
            pp.comma_breakable
            pp.group {
              t = self.ctime
              pp.text "ctime="; pp.pp t
              pp.breakable; pp.text "(#{t.tv_sec})"
            }
          }
        end

[Validate]