Class: Fit::ColumnFixture

Inherits:
Fixture
  • Object
show all
Defined in:
lib/fit/column_fixture.rb

Constant Summary

Constants inherited from Fixture

Fixture::GRAY, Fixture::GREEN, Fixture::RED, Fixture::YELLOW

Instance Attribute Summary

Attributes inherited from Fixture

#args, #counts, #listener, #summary

Instance Method Summary collapse

Methods inherited from Fixture

camel, #do_cells, #do_table, #do_tables, #error, escape, #exception, #find_class, #fixture_name, #get_args_for_table, #get_linked_fixture_with_args, gray, #ignore, #info, #initialize, #interpret_following_tables, #interpret_tables, label, metadata, #parse, #right, #total_errors, #totals, #wrong

Constructor Details

This class inherits a constructor from Fit::Fixture

Instance Method Details

#check(cell, adapter) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
# File 'lib/fit/column_fixture.rb', line 50

def check cell, adapter
  unless @has_executed
    begin
      execute
    rescue Exception => e
      exception cell, e
    end
    @has_executed = true
  end
  super
end

#do_cell(cell, column_index) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/fit/column_fixture.rb', line 32

def do_cell cell, column_index
  adapter = @column_bindings[column_index]
  begin
    text = cell.text
    if text.empty?
      check cell, adapter
    elsif adapter.nil?
      ignore cell
    elsif adapter.is_output?
      check cell, adapter
    else
      adapter.set(adapter.parse(text))
    end
  rescue Exception => e
    exception cell, e
  end
end

#do_row(row) ⇒ Object



21
22
23
24
25
26
27
28
29
30
# File 'lib/fit/column_fixture.rb', line 21

def do_row row
  @has_executed = false
  begin
    reset
    super
    execute if not @has_executed
  rescue Exception => e
    exception row.leaf, e
  end
end

#do_rows(rows) ⇒ Object

Traversal



16
17
18
19
# File 'lib/fit/column_fixture.rb', line 16

def do_rows rows
  bind rows.parts
  super(rows.more)
end

#executeObject



66
67
68
# File 'lib/fit/column_fixture.rb', line 66

def execute
  # about to process first method call of row
end

#resetObject



62
63
64
# File 'lib/fit/column_fixture.rb', line 62

def reset
  # about to process first cell of row
end