class Druid::Elements::TableRow
Public Instance Methods
[](what)
click to toggle source
Return the Druid::Elements::TableCell
for the index provided. Index is zero based. If the index provided is a String then it will be matched with the text from the columns in the first row.
# File lib/druid/elements/table_row.rb, line 11 def [](what) idx = find_index(what) idx && cell_items[idx] end
columns()
click to toggle source
Returns the number of colums in the table
# File lib/druid/elements/table_row.rb, line 19 def columns cell_items.size end
each(&block)
click to toggle source
iterator that yields with a Druid::Elements::TableCell
# File lib/druid/elements/table_row.rb, line 26 def each(&block) cell_items.each(&block) end
Private Instance Methods
cell_items()
click to toggle source
# File lib/druid/elements/table_row.rb, line 32 def cell_items @cell_items ||= element.cells.map do |obj| Druid::Elements::TableCell.new(obj) end end
find_index(what)
click to toggle source
# File lib/druid/elements/table_row.rb, line 38 def find_index(what) return what if what.is_a? Integer parent(tag_name: 'table').headers.find_index do |header| header.text.include? what end end