Module: Archive::Zip::ExtraField
- Defined in:
- lib/archive/zip/extra_field.rb,
lib/archive/zip/extra_field/raw.rb,
lib/archive/zip/extra_field/unix.rb,
lib/archive/zip/extra_field/extended_timestamp.rb
Defined Under Namespace
Classes: ExtendedTimestamp, Raw, Unix
Constant Summary collapse
- EXTRA_FIELDS =
A Hash used to map extra field header identifiers to extra field classes.
{}
Class Method Summary collapse
-
.parse_central(header_id, data) ⇒ Object
Returns an instance of an extra field class by selecting the class using header_id and passing data to the class’ parse_central method.
-
.parse_local(header_id, data) ⇒ Object
Returns an instance of an extra field class by selecting the class using header_id and passing data to the class’ parse_local method.
Class Method Details
.parse_central(header_id, data) ⇒ Object
Returns an instance of an extra field class by selecting the class using header_id and passing data to the class’ parse_central method. If there is no mapping from a given value of header_id to an extra field class, an instance of Archive::Zip::Entry::ExtraField::Raw is returned.
12 13 14 15 16 17 18 |
# File 'lib/archive/zip/extra_field.rb', line 12 def self.parse_central(header_id, data) if EXTRA_FIELDS.has_key?(header_id) then EXTRA_FIELDS[header_id].parse_central(data) else Raw.parse_central(header_id, data) end end |
.parse_local(header_id, data) ⇒ Object
Returns an instance of an extra field class by selecting the class using header_id and passing data to the class’ parse_local method. If there is no mapping from a given value of header_id to an extra field class, an instance of Archive::Zip::Entry::ExtraField::Raw is returned.
24 25 26 27 28 29 30 |
# File 'lib/archive/zip/extra_field.rb', line 24 def self.parse_local(header_id, data) if EXTRA_FIELDS.has_key?(header_id) then EXTRA_FIELDS[header_id].parse_local(data) else Raw.parse_local(header_id, data) end end |