lib/symbiont/web_objects/table.rb in symbiont-0.1.0 vs lib/symbiont/web_objects/table.rb in symbiont-0.1.1
- old
+ new
@@ -7,9 +7,18 @@
# @return [Symbiont::WebObjects::TableRow]
def [](index)
Object::Symbiont::WebObjects::TableRow.new(@web_object[index])
end
+ # This method is an iterator that returns a TableRow object each time through
+ # the loop.
+ # @return [Symbiont::WebObjects::TableRow]
+ def each
+ for index in 1..self.rows do
+ yield self[index - 1]
+ end
+ end
+
# This method will return the number of rows in a table.
def rows
@web_object.wd.find_elements(:xpath, row_xpath).size
end