Class: MooTool::Models::IMG4::PropertySequence
- Inherits:
-
Object
- Object
- MooTool::Models::IMG4::PropertySequence
- Includes:
- Helpers::IMG4
- Defined in:
- lib/mootool/models/img4/property_sequence.rb
Direct Known Subclasses
Constant Summary
Constants included from Helpers::IMG4
Helpers::IMG4::DECODE_TAGS, Helpers::IMG4::FIRMWARE_TAGS, Helpers::IMG4::HASH_LENGTHS, Helpers::IMG4::KEY_INSTANCE_TAGS, Helpers::IMG4::KVP_TAGS, Helpers::IMG4::OCTET_TAGS, Helpers::IMG4::SEQUENCE_TAGS, Helpers::IMG4::SIGNATURE_TAGS
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(input) ⇒ PropertySequence
constructor
A new instance of PropertySequence.
- #inspect ⇒ Object
- #to_h ⇒ Object
Methods included from Helpers::IMG4
#construct, #construct_object, #decode_construct, parse_4cc
Constructor Details
#initialize(input) ⇒ PropertySequence
Returns a new instance of PropertySequence.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/mootool/models/img4/property_sequence.rb', line 10 def initialize(input) construction = construct(input.value.first) @key = construction[0].to_sym value = construction[1] case value when Array, Hash @value = value when PropertySequence @value = { value.key => value.value } end return unless @value.is_a?(Array) @value = @value.map(&:to_h).reduce({}, :merge) end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
8 9 10 |
# File 'lib/mootool/models/img4/property_sequence.rb', line 8 def key @key end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
8 9 10 |
# File 'lib/mootool/models/img4/property_sequence.rb', line 8 def value @value end |
Instance Method Details
#inspect ⇒ Object
30 31 32 |
# File 'lib/mootool/models/img4/property_sequence.rb', line 30 def inspect to_h.ai end |
#to_h ⇒ Object
26 27 28 |
# File 'lib/mootool/models/img4/property_sequence.rb', line 26 def to_h { @key => @value } end |