Class: PageObject::IndexedProperties::TableOfElements
- Inherits:
-
Object
- Object
- PageObject::IndexedProperties::TableOfElements
- Includes:
- PageObject, LoadsPlatform
- Defined in:
- lib/page-object/indexed_properties.rb
Constant Summary
Constants included from PageObject
Instance Attribute Summary
Attributes included from PageObject
Instance Method Summary collapse
- #[](index) ⇒ Object
-
#initialize(browser, identifier_list) ⇒ TableOfElements
constructor
A new instance of TableOfElements.
Methods included from LoadsPlatform
#adapter_for, #browser_for, #browser_root_for, #load_platform, #root_element_for
Methods included from PageObject
add_framework, #alert, #attach_to_window, #back, #clear_cookies, #confirm, #current_url, default_element_wait, default_element_wait=, default_page_wait, default_page_wait=, #element_with_focus, #execute_script, #forward, #html, #in_frame, #in_iframe, included, #initialize_browser, javascript_framework=, #modal_dialog, #navigate_to, #prompt, #refresh, register_widget, #save_screenshot, #text, #title, #wait_for_ajax, #wait_until
Methods included from PagePopulator
Methods included from ElementLocators
Constructor Details
#initialize(browser, identifier_list) ⇒ TableOfElements
Returns a new instance of TableOfElements.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/page-object/indexed_properties.rb', line 7 def initialize (browser, identifier_list) initialize_browser(browser) @identifier_list = identifier_list @indexed_property_class = Class.new { include PageObject include LoadsPlatform extend Accessors def initialize (browser, index, identifier_list) initialize_browser(browser) identifier_list.each do |identifier| type = identifier[0] name = identifier[1] how_and_what = identifier[2].clone # Cannot modify the original... how_and_what.each do |key, value| if key == :index how_and_what[key] = (value % index).to_i else how_and_what[key] = value % index end end self.class.send type, name, how_and_what unless Class.instance_methods.include? name end end } end |
Instance Method Details
#[](index) ⇒ Object
35 36 37 |
# File 'lib/page-object/indexed_properties.rb', line 35 def [] (index) @indexed_property_class.new(@browser, index, @identifier_list) end |