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



8
9
10
# File 'lib/parsers/moov_parser/decoder.rb', line 8

def at
  @at
end

#atom_fieldsObject

Returns the value of attribute atom_fields

Returns:

  • (Object)

    the current value of atom_fields



8
9
10
# File 'lib/parsers/moov_parser/decoder.rb', line 8

def atom_fields
  @atom_fields
end

#atom_sizeObject

Returns the value of attribute atom_size

Returns:

  • (Object)

    the current value of atom_size



8
9
10
# File 'lib/parsers/moov_parser/decoder.rb', line 8

def atom_size
  @atom_size
end

#atom_typeObject

Returns the value of attribute atom_type

Returns:

  • (Object)

    the current value of atom_type



8
9
10
# File 'lib/parsers/moov_parser/decoder.rb', line 8

def atom_type
  @atom_type
end

#childrenObject

Returns the value of attribute children

Returns:

  • (Object)

    the current value of children



8
9
10
# File 'lib/parsers/moov_parser/decoder.rb', line 8

def children
  @children
end

#pathObject

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



8
9
10
# File 'lib/parsers/moov_parser/decoder.rb', line 8

def path
  @path
end

Instance Method Details

#as_json(*a) ⇒ Object



17
18
19
20
21
# File 'lib/parsers/moov_parser/decoder.rb', line 17

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



13
14
15
# File 'lib/parsers/moov_parser/decoder.rb', line 13

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

#to_sObject



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

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