Class: VirtFS::Stat
Overview
File Stat, contains attributes common to files on all files systems
Constant Summary collapse
- ATTR_ACCESSORS =
Specified File Attributes supported by VirtFS (auto converted to symbols)
%i( atime blksize blockdev? blocks chardev? ctime dev dev_major dev_minor directory? executable? executable_real? file? ftype gid grpowned? ino inspect mode mtime nlink owned? pipe? rdev rdev_major rdev_minor readable? readable_real? setgid? setuid? size size? socket? sticky? symlink? uid world_readable? world_writable? writable? writable_real? zero? )
Class Method Summary collapse
-
.iv_name(name) ⇒ String
Helper to convert attribute name to instance variable name.
Instance Method Summary collapse
-
#<=>(other) ⇒ Object
Sort file stats by modify time.
-
#initialize(obj) ⇒ Stat
constructor
Attribute intializer, accepts Stat or Hash containing attributes.
Constructor Details
#initialize(obj) ⇒ Stat
Attribute intializer, accepts Stat or Hash containing attributes
65 66 67 68 69 70 71 |
# File 'lib/virtfs/stat.rb', line 65 def initialize(obj) if obj.is_a?(VfsRealFile::Stat) stat_init(obj) else hash_init(obj) end end |
Class Method Details
.iv_name(name) ⇒ String
Helper to convert attribute name to instance variable name
55 56 57 58 |
# File 'lib/virtfs/stat.rb', line 55 def self.iv_name(name) name = name.to_s.chomp('?') if name.to_s.end_with?('?') "@#{name}" end |
Instance Method Details
#<=>(other) ⇒ Object
Sort file stats by modify time
74 75 76 77 78 |
# File 'lib/virtfs/stat.rb', line 74 def <=>(other) return -1 if mtime < other.mtime return 1 if mtime > other.mtime 0 end |