Class: SeleniumRecord::Lookup::ClassMethods::LookupStrategy
- Inherits:
-
Object
- Object
- SeleniumRecord::Lookup::ClassMethods::LookupStrategy
- Defined in:
- lib/selenium_record/lookup.rb
Overview
Base class for all lookup strategies
Direct Known Subclasses
MatchingStrategy, RelativePathStrategy, RelativeTitleStrategy, RootStrategy
Instance Attribute Summary collapse
-
#lookup_attributes ⇒ Object
readonly
Returns the value of attribute lookup_attributes.
Instance Method Summary collapse
-
#initialize(klass, attrs = {}) ⇒ LookupStrategy
constructor
A new instance of LookupStrategy.
-
#lookup_sequence(&block) ⇒ Object
Defines for the class the instance methods required for the lookup sequence.
Constructor Details
#initialize(klass, attrs = {}) ⇒ LookupStrategy
Returns a new instance of LookupStrategy.
64 65 66 67 |
# File 'lib/selenium_record/lookup.rb', line 64 def initialize(klass, attrs = {}) @klass = klass @attributes_blk = -> { attrs } end |
Instance Attribute Details
#lookup_attributes ⇒ Object (readonly)
Returns the value of attribute lookup_attributes.
58 59 60 |
# File 'lib/selenium_record/lookup.rb', line 58 def lookup_attributes @lookup_attributes end |
Instance Method Details
#lookup_sequence(&block) ⇒ Object
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
73 74 75 76 77 78 79 80 81 |
# 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 |