Class: DiffOutputTable

Inherits:
DiffOutput show all
Defined in:
lib/coopy/diff_output_table.rb

Direct Known Subclasses

DiffRenderCsv, DiffRenderHtml, DiffRenderLog

Instance Method Summary collapse

Methods inherited from DiffOutput

#to_string, #want_context

Instance Method Details

#apply_row(rc) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/coopy/diff_output_table.rb', line 24

def apply_row(rc)
  self.begin_row(rc.row_mode)
  self.insert_cell(rc.row_mode,
                   (rc.row_mode=="->") ? rc.row_mode : "",
                   (rc.row_mode=="->") ? rc.row_mode : "")
  rc.cells.each do |cell|
    if cell[:new_value]
      self.insert_cell(quote(cell[:value]) + "->" + quote(cell[:new_value]),
                       cell[:cell_mode],
                       "->")
    else
      self.insert_cell(cell[:txt],cell[:cell_mode],cell[:separator])
    end
  end
  self.end_row
end

#begin_diffObject



41
42
43
# File 'lib/coopy/diff_output_table.rb', line 41

def begin_diff
  self.begin_table
end

#begin_row(mode) ⇒ Object



10
11
# File 'lib/coopy/diff_output_table.rb', line 10

def begin_row(mode)
end

#begin_tableObject



4
5
# File 'lib/coopy/diff_output_table.rb', line 4

def begin_table
end

#end_diffObject



45
46
47
# File 'lib/coopy/diff_output_table.rb', line 45

def end_diff
  self.end_table
end

#end_rowObject



16
17
# File 'lib/coopy/diff_output_table.rb', line 16

def end_row
end

#end_tableObject



7
8
# File 'lib/coopy/diff_output_table.rb', line 7

def end_table
end

#insert_cell(txt, mode, separator) ⇒ Object



13
14
# File 'lib/coopy/diff_output_table.rb', line 13

def insert_cell(txt,mode,separator)
end

#quote(x) ⇒ Object



19
20
21
22
# File 'lib/coopy/diff_output_table.rb', line 19

def quote(x)
  return "" if x.nil?
  x
end