Class: Domkey::View::PageObjectCollection
- Inherits:
-
Object
- Object
- Domkey::View::PageObjectCollection
- Includes:
- Widgetry::Package, Enumerable
- Defined in:
- lib/domkey/view/page_object_collection.rb
Overview
PageObjectCollection see PageObject for detailes. Compose PageObjectCollection with package and container
What is a container? see PageObject container
What is package? see PageObject package except the following: package can be one of the following:
- definition of watir elements collection i.e. `-> { text_fields(:class, /^foo/)}`
- a pageobject i.e. previously instantiated definition watir elements collection
- hash where key defines subelement and value a definition or pageobject
Usage: Clients would not usually instantate this class. A client class which acts as a View would use a :doms factory method to create PageObjectCollection TODO Example:
Direct Known Subclasses
Instance Attribute Summary
Attributes included from Widgetry::Package
Instance Method Summary collapse
- #[](idx) ⇒ PageObject, Hash{Symbol => PageObjectCollection}
- #each(&blk) ⇒ PageObject, Hash{Symbol => PageObjectCollection}
Methods included from Widgetry::Package
Instance Method Details
#[](idx) ⇒ PageObject, Hash{Symbol => PageObjectCollection}
35 36 37 |
# File 'lib/domkey/view/page_object_collection.rb', line 35 def [] idx to_a[idx] end |
#each(&blk) ⇒ PageObject, Hash{Symbol => PageObjectCollection}
25 26 27 28 29 30 31 |
# File 'lib/domkey/view/page_object_collection.rb', line 25 def each(&blk) if package.respond_to?(:each_pair) package.map { |k, v| [k, PageObjectCollection.new(lambda { v }, @container)] }.each { |k, v| yield Hash[k, v] } else instantiator.each { |e| yield PageObject.new(lambda { e }, @container) } end end |