Method: Eg::ArithmeticFixture#do_cell

Defined in:
lib/eg/arithmetic_fixture.rb

#do_cell(cell, column_index) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/eg/arithmetic_fixture.rb', line 16

def do_cell cell, column_index
  case column_index
    when 0 then @x = parse_integer(cell);
    when 1 then @y = parse_integer(cell);
    when 2 then check(cell, parse_integer(cell), @x + @y)
    when 3 then check(cell, parse_integer(cell), @x - @y)
    when 4 then check(cell, parse_integer(cell), @x * @y)
    when 5 then check(cell, parse_integer(cell), @x / @y)
    else ignore(cell)
  end
end