Class: Ole::Storage::FileClass::Stat
- Inherits:
-
Object
- Object
- Ole::Storage::FileClass::Stat
- Defined in:
- lib/ole/file_system.rb
Instance Attribute Summary collapse
-
#blksize ⇒ Object
readonly
Returns the value of attribute blksize.
-
#blocks ⇒ Object
readonly
Returns the value of attribute blocks.
-
#dev ⇒ Object
readonly
Returns the value of attribute dev.
-
#ftype ⇒ Object
readonly
Returns the value of attribute ftype.
-
#gid ⇒ Object
readonly
Returns the value of attribute gid.
-
#ino ⇒ Object
readonly
Returns the value of attribute ino.
-
#nlink ⇒ Object
readonly
Returns the value of attribute nlink.
-
#rdev ⇒ Object
(also: #rdev_major, #rdev_minor)
readonly
Returns the value of attribute rdev.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#uid ⇒ Object
readonly
Returns the value of attribute uid.
Instance Method Summary collapse
- #directory? ⇒ Boolean
- #file? ⇒ Boolean
-
#initialize(dirent) ⇒ Stat
constructor
A new instance of Stat.
- #inspect ⇒ Object
Constructor Details
#initialize(dirent) ⇒ Stat
Returns a new instance of Stat.
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/ole/file_system.rb', line 82 def initialize dirent @dirent = dirent @size = dirent.size if file? @ftype = 'file' bat = dirent.ole.bat_for_size(dirent.size) @blocks = bat.chain(dirent.first_block).length @blksize = bat.block_size else @ftype = 'directory' @blocks = 0 @blksize = 0 end # a lot of these are bogus. ole file format has no analogs @nlink = 1 @uid, @gid = 0, 0 @dev, @rdev = 0, 0 @ino = 0 # need to add times - atime, mtime, ctime. end |
Instance Attribute Details
#blksize ⇒ Object (readonly)
Returns the value of attribute blksize.
80 81 82 |
# File 'lib/ole/file_system.rb', line 80 def blksize @blksize end |
#blocks ⇒ Object (readonly)
Returns the value of attribute blocks.
80 81 82 |
# File 'lib/ole/file_system.rb', line 80 def blocks @blocks end |
#dev ⇒ Object (readonly)
Returns the value of attribute dev.
81 82 83 |
# File 'lib/ole/file_system.rb', line 81 def dev @dev end |
#ftype ⇒ Object (readonly)
Returns the value of attribute ftype.
80 81 82 |
# File 'lib/ole/file_system.rb', line 80 def ftype @ftype end |
#gid ⇒ Object (readonly)
Returns the value of attribute gid.
81 82 83 |
# File 'lib/ole/file_system.rb', line 81 def gid @gid end |
#ino ⇒ Object (readonly)
Returns the value of attribute ino.
81 82 83 |
# File 'lib/ole/file_system.rb', line 81 def ino @ino end |
#nlink ⇒ Object (readonly)
Returns the value of attribute nlink.
81 82 83 |
# File 'lib/ole/file_system.rb', line 81 def nlink @nlink end |
#rdev ⇒ Object (readonly) Also known as: rdev_major, rdev_minor
Returns the value of attribute rdev.
81 82 83 |
# File 'lib/ole/file_system.rb', line 81 def rdev @rdev end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
80 81 82 |
# File 'lib/ole/file_system.rb', line 80 def size @size end |
#uid ⇒ Object (readonly)
Returns the value of attribute uid.
81 82 83 |
# File 'lib/ole/file_system.rb', line 81 def uid @uid end |
Instance Method Details
#directory? ⇒ Boolean
110 111 112 |
# File 'lib/ole/file_system.rb', line 110 def directory? @dirent.dir? end |
#file? ⇒ Boolean
106 107 108 |
# File 'lib/ole/file_system.rb', line 106 def file? @dirent.file? end |
#inspect ⇒ Object
114 115 116 117 118 119 |
# File 'lib/ole/file_system.rb', line 114 def inspect pairs = (instance_variables - ['@dirent']).map do |n| "#{n[1..-1]}=#{instance_variable_get n}" end "#<#{self.class} #{pairs * ', '}>" end |