Class: Coopy::TableDiff

Inherits:
Object
  • Object
show all
Defined in:
lib/lib/coopy/table_diff.rb

Instance Method Summary collapse

Constructor Details

#initialize(align, flags) ⇒ TableDiff

Returns a new instance of TableDiff.



7
8
9
10
11
12
# File 'lib/lib/coopy/table_diff.rb', line 7

def initialize(align,flags)
  @align = align
  @flags = flags
  @builder = nil
  @preserve_columns = false
end

Instance Method Details

#get_comparison_stateObject



1157
1158
1159
1160
# File 'lib/lib/coopy/table_diff.rb', line 1157

def get_comparison_state 
  return nil if @align == nil
  @align.comp
end

#get_summaryObject



1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
# File 'lib/lib/coopy/table_diff.rb', line 1162

def get_summary 
  ds = ::Coopy::DiffSummary.new
  ds.row_deletes = @row_deletes
  ds.row_inserts = @row_inserts
  ds.row_updates = @row_updates
  ds.row_reorders = @row_reorders
  ds.col_deletes = @col_deletes
  ds.col_inserts = @col_inserts
  ds.col_updates = @col_updates
  ds.col_renames = @col_renames
  ds.col_reorders = @col_reorders
  ds.row_count_initial_with_header = @align.get_source.get_height
  ds.row_count_final_with_header = @align.get_target.get_height
  ds.row_count_initial = @align.get_source.get_height - @align.get_source_header - 1
  ds.row_count_final = @align.get_target.get_height - @align.get_target_header - 1
  ds.col_count_initial = @align.get_source.get_width
  ds.col_count_final = @align.get_target.get_width
  ds
end

#has_differenceObject



1145
1146
1147
# File 'lib/lib/coopy/table_diff.rb', line 1145

def has_difference 
  @diff_found
end

#has_schema_differenceObject



1149
1150
1151
# File 'lib/lib/coopy/table_diff.rb', line 1149

def has_schema_difference 
  @schema_diff_found
end

#hilite(output) ⇒ Object



990
991
992
993
# File 'lib/lib/coopy/table_diff.rb', line 990

def hilite(output)
  output = ::Coopy::Coopy.tablify(output)
  self.hilite_single(output)
end

#hilite_with_nesting(output) ⇒ Object



1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
# File 'lib/lib/coopy/table_diff.rb', line 1118

def hilite_with_nesting(output)
  base = output.add("base")
  result = self.hilite_single(base)
  return false if !result
  return true if @align.comp == nil
  order = @align.comp.child_order
  return true if order == nil
  output.alignment = @align
  begin
    _g = 0
    while(_g < order.length) 
      name = order[_g]
      _g+=1
      child = @align.comp.children[name]
      alignment = child.alignment
      if alignment.is_marked_as_identical 
        @align.comp.children[name] = nil
        next
      end
      td = ::Coopy::TableDiff.new(alignment,@flags)
      child_output = output.add(name)
      result = result && td.hilite_single(child_output)
    end
  end
  result
end

#is_nestedObject



1153
1154
1155
# File 'lib/lib/coopy/table_diff.rb', line 1153

def is_nested 
  @nesting_present
end

#set_cell_builder(builder) ⇒ Object



69
70
71
# File 'lib/lib/coopy/table_diff.rb', line 69

def set_cell_builder(builder)
  @builder = builder
end