Class: AePageObjects::Collection
- Includes:
- Enumerable
- Defined in:
- lib/ae_page_objects/elements/collection.rb
Constant Summary
Constants included from Node::Methods
Node::Methods::METHODS_TO_DELEGATE_TO_NODE
Class Attribute Summary collapse
-
.item_class ⇒ Object
Returns the value of attribute item_class.
Instance Attribute Summary collapse
-
#item_locator ⇒ Object
readonly
Returns the value of attribute item_locator.
Attributes inherited from Element
Instance Method Summary collapse
- #[](index) ⇒ Object
- #at(index) ⇒ Object
- #each ⇒ Object
- #item_class ⇒ Object
- #last ⇒ Object
- #size ⇒ Object
Methods inherited from Element
#__full_name__, #__name__, #browser, #document, #full_name, #initialize, #name, #to_s, #using_default_locator?, #window
Methods included from Dsl
#collection, #element, #form_for, #inherited
Methods included from InternalHelpers
Methods included from Node::ClassMethods
#current_url, #current_url_without_params, #new_subclass
Methods included from AePageObjects::Concerns::Staleable
Methods included from AePageObjects::Concerns::LoadEnsuring
Methods included from Node::Methods
#current_url, #current_url_without_params, #document, #initialize, #node
Constructor Details
This class inherits a constructor from AePageObjects::Element
Class Attribute Details
.item_class ⇒ Object
Returns the value of attribute item_class.
8 9 10 |
# File 'lib/ae_page_objects/elements/collection.rb', line 8 def item_class @item_class end |
Instance Attribute Details
#item_locator ⇒ Object (readonly)
Returns the value of attribute item_locator.
5 6 7 |
# File 'lib/ae_page_objects/elements/collection.rb', line 5 def item_locator @item_locator end |
Instance Method Details
#[](index) ⇒ Object
31 32 33 |
# File 'lib/ae_page_objects/elements/collection.rb', line 31 def [](index) at(index) end |
#at(index) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/ae_page_objects/elements/collection.rb', line 23 def at(index) if index >= size || index < 0 nil else item_at(index) end end |
#each ⇒ Object
35 36 37 38 39 |
# File 'lib/ae_page_objects/elements/collection.rb', line 35 def each (0..(size - 1)).each do |index| yield at(index) end end |
#item_class ⇒ Object
18 19 20 |
# File 'lib/ae_page_objects/elements/collection.rb', line 18 def item_class self.class.item_class end |
#last ⇒ Object
45 46 47 |
# File 'lib/ae_page_objects/elements/collection.rb', line 45 def last self.at(size - 1) end |
#size ⇒ Object
41 42 43 |
# File 'lib/ae_page_objects/elements/collection.rb', line 41 def size node.all(:xpath, item_xpath).size end |