Class: Cucumber::Tree::Table

Inherits:
Object
  • Object
show all
Defined in:
lib/gems/cucumber-0.1.15/lib/cucumber/tree/table.rb

Instance Method Summary collapse

Constructor Details

#initialize(rows) ⇒ Table

Returns a new instance of Table.



4
5
6
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/tree/table.rb', line 4

def initialize(rows)
  @rows = rows
end

Instance Method Details

#|(cell) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/tree/table.rb', line 8

def |(cell)
  @row ||= []
  if cell == self
    line = *caller[0].split(':')[1].to_i
    @row.instance_eval %{
      def line
        #{line}
      end
    }
    @rows << @row
    @row = nil
  else
    @row << cell.to_s
  end
  self
end