Class: RSpec::Parameterized::TableSyntax::Table
- Inherits:
-
Object
- Object
- RSpec::Parameterized::TableSyntax::Table
- Defined in:
- lib/rspec/parameterized/table_syntax/table.rb
Defined Under Namespace
Classes: Row
Instance Attribute Summary collapse
-
#last_row ⇒ Object
readonly
Returns the value of attribute last_row.
Instance Method Summary collapse
- #add_param_to_last_row(param) ⇒ Object (also: #|)
- #add_row(row) ⇒ Object
-
#initialize ⇒ Table
constructor
A new instance of Table.
- #to_a ⇒ Object (also: #to_params)
Constructor Details
#initialize ⇒ Table
Returns a new instance of Table.
7 8 9 10 |
# File 'lib/rspec/parameterized/table_syntax/table.rb', line 7 def initialize @rows = [] @last_row = nil end |
Instance Attribute Details
#last_row ⇒ Object (readonly)
Returns the value of attribute last_row.
5 6 7 |
# File 'lib/rspec/parameterized/table_syntax/table.rb', line 5 def last_row @last_row end |
Instance Method Details
#add_param_to_last_row(param) ⇒ Object Also known as: |
20 21 22 23 |
# File 'lib/rspec/parameterized/table_syntax/table.rb', line 20 def add_param_to_last_row(param) last_row.add_param(param) self end |
#add_row(row) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/rspec/parameterized/table_syntax/table.rb', line 12 def add_row(row) unless @rows.find {|r| r.object_id == row.object_id} @rows << row @last_row = row end self end |
#to_a ⇒ Object Also known as: to_params
26 27 28 |
# File 'lib/rspec/parameterized/table_syntax/table.rb', line 26 def to_a @rows.map(&:to_a) end |