Sha256: e09af28f5a99ad1129c02c8201784f380fcf8037096274de697656332f29f051

Contents?: true

Size: 985 Bytes

Versions: 2

Compression:

Stored size: 985 Bytes

Contents

module PageObject
  module IndexedProperties
    class RowOfElements
      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

    class TableOfElements
      include PageObject
      include LoadsPlatform

      def initialize (browser, identifier_list)
        initialize_browser(browser)
        @identifier_list = identifier_list
      end

      def [] (index)
        RowOfElements.new(@browser, index, @identifier_list)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
page-object-1.0.2 lib/page-object/indexed_properties.rb
page-object-1.0.1 lib/page-object/indexed_properties.rb