Class: Gamera::PageSections::TableRow
- Inherits:
-
Capybara::Node::Element
- Object
- Capybara::Node::Element
- Gamera::PageSections::TableRow
- Defined in:
- lib/gamera/page_sections/table.rb
Overview
Default class used to represent a row in a table
Instance Method Summary collapse
-
#initialize(row_css, headers) ⇒ TableRow
constructor
A new instance of TableRow.
Constructor Details
#initialize(row_css, headers) ⇒ TableRow
Returns a new instance of TableRow.
222 223 224 225 226 227 228 229 230 231 |
# File 'lib/gamera/page_sections/table.rb', line 222 def initialize(row_css, headers) super(row_css) headers.each_with_index do |header, i| cell_name = header.downcase.tr(' ', '_').gsub(/[^a-z0-9_]+/, '') self.class.send(:define_method, cell_name) do find("td:nth-child(#{i + 1})").text end end end |