Module: TheArch::Parser

Defined in:
lib/the_arch/parser.rb

Class Method Summary collapse

Class Method Details

.parse(xml) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
# File 'lib/the_arch/parser.rb', line 2

def self.parse(xml)
  document = Nokogiri::XML.parse(xml)
  data = document.xpath("/plist/dict/dict")

  data.map do |node|
    strings = node.children.map(&:text)
    pairs = strings.each_slice(2).to_a

    Hashie::Mash.new(Hash[pairs])
  end
end