Class: SparklingWatir::ElementCollection
- Inherits:
-
Object
- Object
- SparklingWatir::ElementCollection
- Includes:
- Enumerable
- Defined in:
- lib/sparkling_watir/element_collection.rb
Instance Attribute Summary collapse
-
#driver ⇒ Object
readonly
Returns the value of attribute driver.
-
#selector ⇒ Object
readonly
Returns the value of attribute selector.
Instance Method Summary collapse
- #[](value) ⇒ Object
- #add(element) ⇒ Object
- #each ⇒ Object
- #first ⇒ Object
-
#initialize(driver, selector) ⇒ ElementCollection
constructor
A new instance of ElementCollection.
- #last ⇒ Object
- #to_a ⇒ Object
Constructor Details
#initialize(driver, selector) ⇒ ElementCollection
9 10 11 12 13 |
# File 'lib/sparkling_watir/element_collection.rb', line 9 def initialize(driver, selector) @driver = driver @selector = selector @collection = create_collection end |
Instance Attribute Details
#driver ⇒ Object (readonly)
Returns the value of attribute driver.
7 8 9 |
# File 'lib/sparkling_watir/element_collection.rb', line 7 def driver @driver end |
#selector ⇒ Object (readonly)
Returns the value of attribute selector.
7 8 9 |
# File 'lib/sparkling_watir/element_collection.rb', line 7 def selector @selector end |
Instance Method Details
#[](value) ⇒ Object
37 38 39 |
# File 'lib/sparkling_watir/element_collection.rb', line 37 def [](value) @collection[value] end |
#add(element) ⇒ Object
15 16 17 |
# File 'lib/sparkling_watir/element_collection.rb', line 15 def add(element) @collection << element end |
#each ⇒ Object
19 20 21 22 23 |
# File 'lib/sparkling_watir/element_collection.rb', line 19 def each @collection.each do |element| yield element end end |
#first ⇒ Object
41 42 43 |
# File 'lib/sparkling_watir/element_collection.rb', line 41 def first @collection.first end |
#last ⇒ Object
45 46 47 |
# File 'lib/sparkling_watir/element_collection.rb', line 45 def last @collection.last end |
#to_a ⇒ Object
33 34 35 |
# File 'lib/sparkling_watir/element_collection.rb', line 33 def to_a @collection end |