Class: Cabriolet::Models::LITDirectory
- Inherits:
-
Object
- Object
- Cabriolet::Models::LITDirectory
- Defined in:
- lib/cabriolet/models/lit_header.rb
Overview
Represents the internal directory structure
Directory contains file entries with encoded integers for efficiency
Instance Attribute Summary collapse
-
#count_chunklen ⇒ Object
Returns the value of attribute count_chunklen.
-
#entries ⇒ Object
Returns the value of attribute entries.
-
#entry_chunklen ⇒ Object
Returns the value of attribute entry_chunklen.
-
#num_chunks ⇒ Object
Returns the value of attribute num_chunks.
Instance Method Summary collapse
-
#entries_in_section(section_id) ⇒ Array<LITDirectoryEntry>
Get all entries in a section.
-
#find(name) ⇒ LITDirectoryEntry?
Find entry by name.
-
#initialize ⇒ LITDirectory
constructor
A new instance of LITDirectory.
Constructor Details
#initialize ⇒ LITDirectory
Returns a new instance of LITDirectory.
95 96 97 98 99 100 |
# File 'lib/cabriolet/models/lit_header.rb', line 95 def initialize @entries = [] @num_chunks = 0 @entry_chunklen = 0 @count_chunklen = 0 end |
Instance Attribute Details
#count_chunklen ⇒ Object
Returns the value of attribute count_chunklen.
93 94 95 |
# File 'lib/cabriolet/models/lit_header.rb', line 93 def count_chunklen @count_chunklen end |
#entries ⇒ Object
Returns the value of attribute entries.
93 94 95 |
# File 'lib/cabriolet/models/lit_header.rb', line 93 def entries @entries end |
#entry_chunklen ⇒ Object
Returns the value of attribute entry_chunklen.
93 94 95 |
# File 'lib/cabriolet/models/lit_header.rb', line 93 def entry_chunklen @entry_chunklen end |
#num_chunks ⇒ Object
Returns the value of attribute num_chunks.
93 94 95 |
# File 'lib/cabriolet/models/lit_header.rb', line 93 def num_chunks @num_chunks end |
Instance Method Details
#entries_in_section(section_id) ⇒ Array<LITDirectoryEntry>
Get all entries in a section
114 115 116 |
# File 'lib/cabriolet/models/lit_header.rb', line 114 def entries_in_section(section_id) entries.select { |e| e.section == section_id } end |
#find(name) ⇒ LITDirectoryEntry?
Find entry by name
106 107 108 |
# File 'lib/cabriolet/models/lit_header.rb', line 106 def find(name) entries.find { |e| e.name == name } end |