class PageObject::IndexedProperties::TableOfElements

Public Class Methods

new(browser, identifier_list) click to toggle source
# 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|
          how_and_what[key] = value % index
        end
        self.class.send type, name, how_and_what unless self.class.instance_methods.include? name
      end
    end
  }
end

Public Instance Methods

[](index) click to toggle source
# File lib/page-object/indexed_properties.rb, line 31
def [] (index)
  @indexed_property_class.new(@browser,index,@identifier_list)
end