Class: MppReader::Cfbf::Directory
- Inherits:
-
Object
- Object
- MppReader::Cfbf::Directory
- Defined in:
- lib/mpp_reader/cfbf/directory.rb
Overview
Parses the directory sector chain and links each storage’s red-black sibling tree into a flat children hash (keyed by upcased name).
Instance Attribute Summary collapse
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
-
#initialize(dir_bytes) ⇒ Directory
constructor
A new instance of Directory.
Constructor Details
#initialize(dir_bytes) ⇒ Directory
Returns a new instance of Directory.
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/mpp_reader/cfbf/directory.rb', line 38 def initialize(dir_bytes) @entries = [] (dir_bytes.bytesize / 128).times do |i| record = dir_bytes.byteslice(i * 128, 128) @entries << (record.getbyte(66).to_i.zero? ? nil : Entry.new(record)) end @root = @entries[0] unless @root && @root.type == Entry::TYPE_ROOT raise CorruptFileError, "compound file has no root directory entry" end link_all_children end |
Instance Attribute Details
#root ⇒ Object (readonly)
Returns the value of attribute root.
36 37 38 |
# File 'lib/mpp_reader/cfbf/directory.rb', line 36 def root @root end |