Sha256: aa7eb5c1ce962b06f505a3debc820c088fec85847c856ba2c53db4993b3d269e

Contents?: true

Size: 702 Bytes

Versions: 3

Compression:

Stored size: 702 Bytes

Contents

# encoding: utf-8
module Laximo

  module Respond

    class ListQuickDetail < Laximo::Respond::Base

      def parsing_result(str)

        str.xpath('//ListQuickDetail/Category').inject([]) { |arr, node|

          h = node_to_hash(node) { |h1, n1|

            h1[:unit] = n1.xpath('./Unit').inject([]) { |arr1, n2|

              arr1 << node_to_hash(n2) { |h2, n3|

                h1[:attributes] = nodes_to_hash(n3.xpath('./attribute'))
                h1[:details]    = nodes_to_hash(n3.xpath('./Detail/attribute'))

              }

            }

          }

          arr << h unless h.empty?

        }

      end # parsing_result

    end # ListQuickDetail

  end # Respond

end # Laximo

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
laximo-0.5.0 lib/laximo/respond/list_quick_detail.rb
laximo-0.4.2 lib/laximo/respond/list_quick_detail.rb
laximo-0.4.1 lib/laximo/respond/list_quick_detail.rb