Class: Resilience::FSDir::FileEntry
- Inherits:
-
Object
- Object
- Resilience::FSDir::FileEntry
- Defined in:
- lib/resilience/fs_dir/file_entry.rb
Instance Attribute Summary collapse
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#metadata_attrs ⇒ Object
known metadata attributes.
-
#name ⇒ Object
Returns the value of attribute name.
-
#prefix ⇒ Object
Returns the value of attribute prefix.
-
#record ⇒ Object
metadata record.
Instance Method Summary collapse
- #fullname ⇒ Object
-
#initialize(args = {}) ⇒ FileEntry
constructor
A new instance of FileEntry.
- #parse_attrs ⇒ Object
- #total_offset ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ FileEntry
Returns a new instance of FileEntry.
20 21 22 23 24 25 26 |
# File 'lib/resilience/fs_dir/file_entry.rb', line 20 def initialize(args={}) @prefix = args[:prefix] @name = args[:name] @metadata = args[:metadata] @record = args[:record] parse_attrs end |
Instance Attribute Details
#metadata ⇒ Object
Returns the value of attribute metadata.
12 13 14 |
# File 'lib/resilience/fs_dir/file_entry.rb', line 12 def @metadata end |
#metadata_attrs ⇒ Object
known metadata attributes
18 19 20 |
# File 'lib/resilience/fs_dir/file_entry.rb', line 18 def @metadata_attrs end |
#name ⇒ Object
Returns the value of attribute name.
11 12 13 |
# File 'lib/resilience/fs_dir/file_entry.rb', line 11 def name @name end |
#prefix ⇒ Object
Returns the value of attribute prefix.
10 11 12 |
# File 'lib/resilience/fs_dir/file_entry.rb', line 10 def prefix @prefix end |
#record ⇒ Object
metadata record
15 16 17 |
# File 'lib/resilience/fs_dir/file_entry.rb', line 15 def record @record end |
Instance Method Details
#fullname ⇒ Object
28 29 30 |
# File 'lib/resilience/fs_dir/file_entry.rb', line 28 def fullname "#{prefix}\\#{name}" end |
#parse_attrs ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/resilience/fs_dir/file_entry.rb', line 36 def parse_attrs = @metadata.unpack('C*') = @metadata.unpack('L*') attr1_length = [0] attr1_dwords = attr1_length/4 attr2_length = [attr1_dwords] attr2_dwords = attr2_length/4 attr3_length = [attr1_dwords + attr2_dwords] # there may be other attrs after this point... attr1 = [0..attr1_length] attr2 = [attr1_length..attr1_length+attr2_length] attr3 = [attr1_length+attr2_length..attr1_length+attr2_length+attr3_length] @metadata_attrs = [attr1, attr2, attr3] end |
#total_offset ⇒ Object
32 33 34 |
# File 'lib/resilience/fs_dir/file_entry.rb', line 32 def total_offset image.offset + record.attribute.pos end |