Class: Capybara::PomPom::Table

Inherits:
Object
  • Object
show all
Defined in:
lib/capybara/pompom/table.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table, row_wrapper = nil) ⇒ Table

Returns a new instance of Table.



7
8
9
10
# File 'lib/capybara/pompom/table.rb', line 7

def initialize(table, row_wrapper = nil)
  @table = table
  @row_wrapper = row_wrapper || TableRow
end

Instance Attribute Details

#row_wrapperObject (readonly)

Returns the value of attribute row_wrapper.



5
6
7
# File 'lib/capybara/pompom/table.rb', line 5

def row_wrapper
  @row_wrapper
end

#tableObject (readonly)

Returns the value of attribute table.



5
6
7
# File 'lib/capybara/pompom/table.rb', line 5

def table
  @table
end

Instance Method Details

#get_row(index) ⇒ Object



12
13
14
15
16
17
# File 'lib/capybara/pompom/table.rb', line 12

def get_row(index)
  row = table.find("tbody tr:nth-child(#{index})")
  row_wrapper.new(row)
rescue Capybara::ElementNotFound => e
  raise TableRowNotFound.new(e)
end