Class: Wombat::Property::Locators::Follow

Inherits:
Base
  • Object
show all
Defined in:
lib/wombat/property/locators/follow.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods included from Wombat::Processing::NodeSelector

#select_nodes

Constructor Details

This class inherits a constructor from Wombat::Property::Locators::Base

Instance Method Details

#locate(context, page = nil) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/wombat/property/locators/follow.rb', line 7

def locate(context, page = nil)
  super do
    locate_nodes(context).flat_map do |node|
      mechanize_page = context.mechanize_page
      link = Mechanize::Page::Link.new(node, page, mechanize_page)
      target_page = page.click link
      context = target_page.parser
      context.mechanize_page = mechanize_page

      filter_properties(context, page)
    end
  end
end