class SeleniumRecord::Lookup::ClassMethods::LookupStrategy

Base class for all lookup strategies

Attributes

lookup_attributes[R]

Public Class Methods

new(klass, attrs = {}) click to toggle source

@param klass [SeleniumObject::Base] class on top over it is defined

the lookup strategy

@param attrs [Hash] attributes used while it is the defined the

lookup sequence
# File lib/selenium_record/lookup.rb, line 64
def initialize(klass, attrs = {})
  @klass = klass
  @attributes_blk = -> { attrs }
end

Public Instance Methods

lookup_sequence(&block) click to toggle source

Defines for the class the instance methods required for the lookup sequence. Inside the block you have access to the “lookup_attributes” specified in the constructor call @param [Block] block defining the lookup sequence

# File lib/selenium_record/lookup.rb, line 73
def lookup_sequence(&block)
  attributes_blk = @attributes_blk
  before_lookup_blk = before_run if respond_to? :before_run
  @klass.instance_eval do
    define_method :lookup_attributes, attributes_blk
    define_method :lookup_sequence, &block
    define_method :before_lookup, before_lookup_blk if before_lookup_blk
  end
end