class Wombat::Property::Locators::Base
Abstract base class
Public Class Methods
new(property)
click to toggle source
# File lib/wombat/property/locators/base.rb, line 11 def initialize(property) @property = property end
Public Instance Methods
locate(context, page = nil) { || ... }
click to toggle source
# File lib/wombat/property/locators/base.rb, line 15 def locate(context, page = nil) @context = context raw_data = yield if block_given? data = @property.respond_to?(:callback) && @property.callback ? @property.callback.call(raw_data) : raw_data @property.wombat_property_name ? { @property.wombat_property_name => data } : data end
Protected Instance Methods
filter_properties(context, page)
click to toggle source
# File lib/wombat/property/locators/base.rb, line 31 def filter_properties(context, page) 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(context, page) } .map { |p| h.merge! p } end end
locate_nodes(context)
click to toggle source
# File lib/wombat/property/locators/base.rb, line 25 def locate_nodes(context) @context = context select_nodes @property.wombat_property_selector, @property.wombat_property_namespaces end