Class: Wombat::Property::Locators::Iterator

Inherits:
Base
  • Object
show all
Defined in:
lib/wombat/property/locators/iterator.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(contex, page = nil) ⇒ Object



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

def locate(contex, page = nil)
  super do
    locate_nodes(contex).flat_map do |node|
      Hash.new.tap do |h|
        @property.values
          .select { |v| v.is_a?(Wombat::DSL::Property) || v.is_a?(Wombat::DSL::PropertyGroup) }
          .map { |p| Factory.locator_for(p).locate(node, page) }
          .map { |p| h.merge! p }
      end
    end
  end
end