Class: RSpec::Parameterized::TableSyntax::Table

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/parameterized/table_syntax/table.rb

Defined Under Namespace

Classes: Row

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTable

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_rowObject (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_aObject 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