Class: Gauge::Table
- Inherits:
-
Object
- Object
- Gauge::Table
- Defined in:
- lib/table.rb
Overview
Holds a table definition. This corresponds to a markdown table defined in the .spec files.
Instance Method Summary collapse
-
#[](index) ⇒ Hash, string[]
Gets the table data.
-
#columns ⇒ string[]
deprecated
Deprecated.
Use [] accessor instead
-
#initialize(protoTable) ⇒ Table
constructor
private
A new instance of Table.
-
#rows ⇒ string[][]
deprecated
Deprecated.
Use #[] accessor instead
Constructor Details
#initialize(protoTable) ⇒ Table
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Table.
23 24 25 26 27 28 29 |
# File 'lib/table.rb', line 23 def initialize(protoTable) @columns = protoTable.headers.cells @rows = [] protoTable.rows.each do |row| @rows.push row.cells end end |
Instance Method Details
#[](index) ⇒ Hash, string[]
Gets the table data.
55 56 57 58 |
# File 'lib/table.rb', line 55 def [](index) return row_values_as_hash(@rows[index]) if index.is_a?(Integer) column_values_as_array(index) end |
#columns ⇒ string[]
Deprecated.
Use [] accessor instead
Gets the column headers of the table
34 35 36 |
# File 'lib/table.rb', line 34 def columns @columns end |
#rows ⇒ string[][]
Deprecated.
Use #[] accessor instead
Gets the rows of the table. The rows are two dimensional arrays.
41 42 43 |
# File 'lib/table.rb', line 41 def rows @rows end |