lib/parsers/moov_parser/decoder.rb
# Finds the first atom in the given Array of Atom structs that
# matches the type, drilling down if a list of atom names is given
Finds the first atom in the given Array of Atom structs that
matches the type, drilling down if a list of atom names is given
Finds the first atom in the given Array of Atom structs that matches the type drilling down if a list of atom names is given
def find_first_atom_by_path(atoms, *atom_types)
    type_to_find = atom_types.shift
    requisite = atoms.find { |e| e.atom_type == type_to_find }
    return requisite if atom_types.empty?
    return unless requisite
    find_first_atom_by_path(requisite.children || [], *atom_types)
  end
def find_first_atom_by_path ( atoms , * atom_types ) type_to_find = atom_types . shift requisite = atoms . find { | e | e . atom_type == type_to_find } return requisite if atom_types . empty? return unless requisite find_first_atom_by_path ( requisite . children || [ ] , * atom_types ) end
Finds the first atom in the given Array of Atom structs that
matches the type, drilling down if a list of atom names is given
Finds the first atom in the given Array of Atom structs that matches the type drilling down if a list of atom names is given
# Return if we found our match # Return nil if we didn't find the match at this nesting level # ...otherwise drill further down
atoms
atom_types