Sha256: afc927eec237b9dcbfd0937dd95333bb942b34fa495514e4d4f791997830afcb
Contents?: true
Size: 704 Bytes
Versions: 6
Compression:
Stored size: 704 Bytes
Contents
# Author:: TAC (tac@tac42.net) require_relative 'yasuri_node' module Yasuri class LinksNode include Node def inject(agent, page, opt = {}) retry_count = opt[:retry_count] || 5 links = page.search(@xpath) || [] # links expected links.map do |link| link_button = Mechanize::Page::Link.new(link, agent, page) child_page = Yasuri.with_retry(retry_count) { link_button.click } child_results_kv = @children.map do |child_node| child_name = Yasuri.NodeName(child_node.name, opt) [child_name, child_node.inject(agent, child_page, opt)] end Hash[child_results_kv] end # each named child node end end end
Version data entries
6 entries across 6 versions & 1 rubygems