Sha256: 60b05c57f7e73941d5f1337e7953b3126b2788fe7e1951dad822d2d7c697fd3f
Contents?: true
Size: 534 Bytes
Versions: 5
Compression:
Stored size: 534 Bytes
Contents
# Author:: TAC (tac@tac42.net) require_relative 'yasuri_node' module Yasuri class StructNode include Node def inject(agent, page, opt = {}) sub_tags = page.search(@xpath) tree = sub_tags.map do |sub_tag| child_results_kv = @children.map do |child_node| child_name = Yasuri.NodeName(child_node.name, opt) [child_name, child_node.inject(agent, sub_tag, opt)] end Hash[child_results_kv] end tree.size == 1 ? tree.first : tree end # inject end end
Version data entries
5 entries across 5 versions & 1 rubygems