Class: Cabriolet::Models::LITDirectory

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initializeLITDirectory

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_chunklenObject

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

#entriesObject

Returns the value of attribute entries.



93
94
95
# File 'lib/cabriolet/models/lit_header.rb', line 93

def entries
  @entries
end

#entry_chunklenObject

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_chunksObject

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

Parameters:

  • section_id (Integer)

    Section ID

Returns:



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

Parameters:

  • name (String)

    Entry name

Returns:



106
107
108
# File 'lib/cabriolet/models/lit_header.rb', line 106

def find(name)
  entries.find { |e| e.name == name }
end