lib/phonelib/data_importer.rb
# method extracts formats and types from xml data
method extracts formats and types from xml data
method extracts formats and types from xml data
def types_and_formats(children)
        result = { types: {}, formats: [] }
        without_comments(children).each do |phone_type|
          if phone_type.name == 'references'
            next
          elsif phone_type.name == 'availableFormats'
            result[:formats] = parse_formats(phone_type.children)
          else
            result[:types][name2sym(phone_type.name)] =
                hash_from_xml(phone_type, :element)
          end
        end
        fill_possible_to_types_if_nil(result)
      end
def types_and_formats ( children ) result = { types : { } , formats : [ ] } without_comments ( children ) . each do | phone_type | if phone_type . name == 'references' next elsif phone_type . name == 'availableFormats' result [ :formats ] = parse_formats ( phone_type . children ) else result [ :types ] [ name2sym ( phone_type . name ) ] = hash_from_xml ( phone_type , :element ) end end fill_possible_to_types_if_nil ( result ) end
method extracts formats and types from xml data
method extracts formats and types from xml data
children
<not_specific>