Class: Pagetience::ElementPlatforms::PageObjectGem
- Defined in:
- lib/pagetience/platforms/page-object-gem.rb
Instance Attribute Summary collapse
-
#page_object_instance ⇒ Object
readonly
Returns the value of attribute page_object_instance.
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(klazz) ⇒ PageObjectGem
constructor
A new instance of PageObjectGem.
- #platform_initialize(args = []) ⇒ Object
- #underlying_element_for(sym) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(klazz) ⇒ PageObjectGem
Returns a new instance of PageObjectGem.
12 13 14 15 16 17 |
# File 'lib/pagetience/platforms/page-object-gem.rb', line 12 def initialize(klazz) super @page_object_instance = klazz @browser = @page_object_instance.browser end |
Instance Attribute Details
#page_object_instance ⇒ Object (readonly)
Returns the value of attribute page_object_instance.
4 5 6 |
# File 'lib/pagetience/platforms/page-object-gem.rb', line 4 def page_object_instance @page_object_instance end |
Class Method Details
.present?(klazz) ⇒ Boolean
7 8 9 |
# File 'lib/pagetience/platforms/page-object-gem.rb', line 7 def present?(klazz) klazz.class.ancestors.include? PageObject end |
Instance Method Details
#platform_initialize(args = []) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/pagetience/platforms/page-object-gem.rb', line 19 def platform_initialize(args=[]) @page_object_instance.class.send(:define_method, :visit) do args[0] || false end @page_object_instance.instance_eval do PageObject.instance_method(:initialize).bind(self).call(@browser, visit) end end |
#underlying_element_for(sym) ⇒ Object
28 29 30 |
# File 'lib/pagetience/platforms/page-object-gem.rb', line 28 def (sym) @page_object_instance.send("#{sym}_element").element end |