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, &block) ⇒ Object
- #at(index, &block) ⇒ Object
- #each(&block) ⇒ Object
- #item_class ⇒ Object
- #last(&block) ⇒ Object
- #size ⇒ Object
Methods inherited from Element
#__full_name__, #__name__, #document, #full_name, #initialize, #name, new, #to_s, #using_default_locator?
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, &block) ⇒ Object
30 31 32 |
# File 'lib/ae_page_objects/elements/collection.rb', line 30 def [](index, &block) at(index, &block) end |
#at(index, &block) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/ae_page_objects/elements/collection.rb', line 22 def at(index, &block) if index >= size || index < 0 nil else item_at(index, &block) end end |
#each(&block) ⇒ Object
34 35 36 37 38 |
# File 'lib/ae_page_objects/elements/collection.rb', line 34 def each(&block) (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(&block) ⇒ Object
44 45 46 |
# File 'lib/ae_page_objects/elements/collection.rb', line 44 def last(&block) self.at(size - 1, &block) end |
#size ⇒ Object
40 41 42 |
# File 'lib/ae_page_objects/elements/collection.rb', line 40 def size node.all(:xpath, item_xpath).size end |