class Laximo::Respond::FindDetail

Public Class Methods

parsing_result(str) click to toggle source
# File lib/laximo/respond/am/find_detail.rb, line 8
def self.parsing_result(str)

  str.xpath('//FindDetails/detail').inject([]) { |arr, node|

    h = node_to_hash(node)

    h[:images]        = nodes_to_hash(node.xpath('./images/image'))
    h[:properties]    = nodes_to_hash(node.xpath('./properties/property'))
    h[:replacements]  = node.xpath('./replacements/replacement').inject([]) { |arr1, n1|

      h1 = node_to_hash(n1)
      h2 = node_to_hash(n1.children[0])
      h1.merge!(h2)

      arr1 << h1

    }

    arr << h

  }

end