Class: Ole::Storage::FileClass::Stat
- Inherits:
-
Object
- Object
- Ole::Storage::FileClass::Stat
- Defined in:
- lib/ole/storage/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
- #size? ⇒ Boolean
Constructor Details
#initialize(dirent) ⇒ Stat
Returns a new instance of Stat.
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/ole/storage/file_system.rb', line 62 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.
60 61 62 |
# File 'lib/ole/storage/file_system.rb', line 60 def blksize @blksize end |
#blocks ⇒ Object (readonly)
Returns the value of attribute blocks.
60 61 62 |
# File 'lib/ole/storage/file_system.rb', line 60 def blocks @blocks end |
#dev ⇒ Object (readonly)
Returns the value of attribute dev.
61 62 63 |
# File 'lib/ole/storage/file_system.rb', line 61 def dev @dev end |
#ftype ⇒ Object (readonly)
Returns the value of attribute ftype.
60 61 62 |
# File 'lib/ole/storage/file_system.rb', line 60 def ftype @ftype end |
#gid ⇒ Object (readonly)
Returns the value of attribute gid.
61 62 63 |
# File 'lib/ole/storage/file_system.rb', line 61 def gid @gid end |
#ino ⇒ Object (readonly)
Returns the value of attribute ino.
61 62 63 |
# File 'lib/ole/storage/file_system.rb', line 61 def ino @ino end |
#nlink ⇒ Object (readonly)
Returns the value of attribute nlink.
61 62 63 |
# File 'lib/ole/storage/file_system.rb', line 61 def nlink @nlink end |
#rdev ⇒ Object (readonly) Also known as: rdev_major, rdev_minor
Returns the value of attribute rdev.
61 62 63 |
# File 'lib/ole/storage/file_system.rb', line 61 def rdev @rdev end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
60 61 62 |
# File 'lib/ole/storage/file_system.rb', line 60 def size @size end |
#uid ⇒ Object (readonly)
Returns the value of attribute uid.
61 62 63 |
# File 'lib/ole/storage/file_system.rb', line 61 def uid @uid end |
Instance Method Details
#directory? ⇒ Boolean
90 91 92 |
# File 'lib/ole/storage/file_system.rb', line 90 def directory? @dirent.dir? end |
#file? ⇒ Boolean
86 87 88 |
# File 'lib/ole/storage/file_system.rb', line 86 def file? @dirent.file? end |
#inspect ⇒ Object
98 99 100 101 102 103 |
# File 'lib/ole/storage/file_system.rb', line 98 def inspect pairs = (instance_variables - ['@dirent']).map do |n| "#{n[1..-1]}=#{instance_variable_get n}" end "#<#{self.class} #{pairs * ', '}>" end |
#size? ⇒ Boolean
94 95 96 |
# File 'lib/ole/storage/file_system.rb', line 94 def size? size if file? end |