Class: AePageObjects::Collection

Inherits:
Element show all
Includes:
Enumerable
Defined in:
lib/ae_page_objects/elements/collection.rb

Constant Summary

Constants inherited from Node

Node::METHODS_TO_DELEGATE_TO_NODE

Class Attribute Summary collapse

Instance Attribute Summary collapse

Attributes inherited from Element

#parent

Instance Method Summary collapse

Methods inherited from Element

#__full_name__, #__name__, #browser, #document, #full_name, #initialize, #name, #to_s, #using_default_locator?, #window

Methods inherited from Node

current_url, #current_url, current_url_without_params, #current_url_without_params, #document, #element, #initialize, #node, #stale!, #stale?

Methods included from Dsl

#collection, #element, #element_attributes, #form_for, #inherited, #is_loaded, #is_loaded_blocks

Methods included from InternalHelpers

#ensure_class_for_param!

Constructor Details

This class inherits a constructor from AePageObjects::Element

Class Attribute Details

.item_classObject

Returns the value of attribute item_class.



10
11
12
# File 'lib/ae_page_objects/elements/collection.rb', line 10

def item_class
  @item_class
end

Instance Attribute Details

#item_locatorObject (readonly)

Returns the value of attribute item_locator.



7
8
9
# File 'lib/ae_page_objects/elements/collection.rb', line 7

def item_locator
  @item_locator
end

Instance Method Details

#[](index) ⇒ Object



33
34
35
# File 'lib/ae_page_objects/elements/collection.rb', line 33

def [](index)
  at(index)
end

#at(index) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/ae_page_objects/elements/collection.rb', line 25

def at(index)
  if index >= size || index < 0
    nil
  else
    item_at(index)
  end
end

#eachObject



37
38
39
40
41
# File 'lib/ae_page_objects/elements/collection.rb', line 37

def each
  size.times do |index|
    yield item_at(index)
  end
end

#item_classObject



20
21
22
# File 'lib/ae_page_objects/elements/collection.rb', line 20

def item_class
  self.class.item_class
end

#lastObject



47
48
49
# File 'lib/ae_page_objects/elements/collection.rb', line 47

def last
  self.at(size - 1)
end

#sizeObject



43
44
45
# File 'lib/ae_page_objects/elements/collection.rb', line 43

def size
  node.all(:xpath, item_xpath, options).size
end