Class: FormatParser::MOOVParser::Decoder::Atom

Inherits:
Struct
  • Object
show all
Defined in:
lib/parsers/moov_parser/decoder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#atObject

Returns the value of attribute at

Returns:

  • (Object)

    the current value of at



5
6
7
# File 'lib/parsers/moov_parser/decoder.rb', line 5

def at
  @at
end

#atom_fieldsObject

Returns the value of attribute atom_fields

Returns:

  • (Object)

    the current value of atom_fields



5
6
7
# File 'lib/parsers/moov_parser/decoder.rb', line 5

def atom_fields
  @atom_fields
end

#atom_sizeObject

Returns the value of attribute atom_size

Returns:

  • (Object)

    the current value of atom_size



5
6
7
# File 'lib/parsers/moov_parser/decoder.rb', line 5

def atom_size
  @atom_size
end

#atom_typeObject

Returns the value of attribute atom_type

Returns:

  • (Object)

    the current value of atom_type



5
6
7
# File 'lib/parsers/moov_parser/decoder.rb', line 5

def atom_type
  @atom_type
end

#childrenObject

Returns the value of attribute children

Returns:

  • (Object)

    the current value of children



5
6
7
# File 'lib/parsers/moov_parser/decoder.rb', line 5

def children
  @children
end

#pathObject

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



5
6
7
# File 'lib/parsers/moov_parser/decoder.rb', line 5

def path
  @path
end

Instance Method Details

#as_json(*a) ⇒ Object



14
15
16
17
18
# File 'lib/parsers/moov_parser/decoder.rb', line 14

def as_json(*a)
  members.each_with_object({}) do |member_name, o|
    o[member_name] = public_send(member_name).as_json(*a)
  end
end

#field_value(data_field) ⇒ Object



10
11
12
# File 'lib/parsers/moov_parser/decoder.rb', line 10

def field_value(data_field)
  (atom_fields || {}).fetch(data_field)
end

#to_sObject



6
7
8
# File 'lib/parsers/moov_parser/decoder.rb', line 6

def to_s
  '%s (%s): %d bytes at offset %d' % [atom_type, path.join('.'), atom_size, at]
end