Class: RSpec::Variants::Table
- Inherits:
-
Object
- Object
- RSpec::Variants::Table
- Defined in:
- lib/rspec/variants/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_condition_to_last_row(condition) ⇒ Object (also: #|)
- #add_row(row) ⇒ Object
-
#initialize ⇒ Table
constructor
A new instance of Table.
- #to_a ⇒ Object (also: #to_conditions)
Constructor Details
#initialize ⇒ Table
Returns a new instance of Table.
6 7 8 9 |
# File 'lib/rspec/variants/table.rb', line 6 def initialize @rows = [] @last_row = nil end |
Instance Attribute Details
#last_row ⇒ Object (readonly)
Returns the value of attribute last_row.
4 5 6 |
# File 'lib/rspec/variants/table.rb', line 4 def last_row @last_row end |
Instance Method Details
#add_condition_to_last_row(condition) ⇒ Object Also known as: |
19 20 21 22 |
# File 'lib/rspec/variants/table.rb', line 19 def add_condition_to_last_row(condition) last_row.add_condition(condition) self end |
#add_row(row) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/rspec/variants/table.rb', line 11 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_conditions
26 27 28 |
# File 'lib/rspec/variants/table.rb', line 26 def to_a @rows.map(&:to_a) end |