Class: Omnizip::Formats::Iso::PathTable::Entry
- Inherits:
-
Object
- Object
- Omnizip::Formats::Iso::PathTable::Entry
- Defined in:
- lib/omnizip/formats/iso/path_table.rb
Overview
Path table entry
Instance Attribute Summary collapse
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parent_directory_number ⇒ Object
readonly
Returns the value of attribute parent_directory_number.
Instance Method Summary collapse
-
#full_path(entries) ⇒ String
Get full path by traversing parent entries.
-
#initialize(name, location, parent_directory_number) ⇒ Entry
constructor
Initialize entry.
Constructor Details
#initialize(name, location, parent_directory_number) ⇒ Entry
Initialize entry
20 21 22 23 24 |
# File 'lib/omnizip/formats/iso/path_table.rb', line 20 def initialize(name, location, parent_directory_number) @name = name @location = location @parent_directory_number = parent_directory_number end |
Instance Attribute Details
#location ⇒ Object (readonly)
Returns the value of attribute location.
13 14 15 |
# File 'lib/omnizip/formats/iso/path_table.rb', line 13 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
13 14 15 |
# File 'lib/omnizip/formats/iso/path_table.rb', line 13 def name @name end |
#parent_directory_number ⇒ Object (readonly)
Returns the value of attribute parent_directory_number.
13 14 15 |
# File 'lib/omnizip/formats/iso/path_table.rb', line 13 def parent_directory_number @parent_directory_number end |
Instance Method Details
#full_path(entries) ⇒ String
Get full path by traversing parent entries
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/omnizip/formats/iso/path_table.rb', line 30 def full_path(entries) return "/" if @parent_directory_number == 1 # Root parts = [@name] current_parent = @parent_directory_number while current_parent > 1 parent = entries[current_parent - 1] break unless parent parts.unshift(parent.name) current_parent = parent.parent_directory_number end "/#{parts.join('/')}" end |