Class: Citronella::Wrapper::PageDecorator
- Inherits:
-
Object
- Object
- Citronella::Wrapper::PageDecorator
- Defined in:
- lib/page_decorator.rb
Instance Method Summary collapse
-
#initialize(driver, webdriver_wait, page, logger) ⇒ PageDecorator
constructor
A wrapper for page object class.
-
#method_missing(attr) ⇒ PageDecorator, WebUi
Looks up the attribute/method name inside the page object.
Constructor Details
#initialize(driver, webdriver_wait, page, logger) ⇒ PageDecorator
A wrapper for page object class.
36 37 38 39 40 41 |
# File 'lib/page_decorator.rb', line 36 def initialize(driver, webdriver_wait, page, logger) @driver = driver @webdriver_wait = webdriver_wait @page = page @logger = logger end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(attr) ⇒ PageDecorator, WebUi
Looks up the attribute/method name inside the page object.
47 48 49 50 51 52 53 54 55 |
# File 'lib/page_decorator.rb', line 47 def method_missing(attr) original_method = @page.new.method(attr) args = original_method.call if args.instance_of?(Class) return PageDecorator.new(@driver, @webdriver_wait, args, @logger) end Citronella::Ui::WebUi.new(@driver, @webdriver_wait, @logger, args, attr, @page.name) end |