Class: Coopy::TableDiff
- Inherits:
-
Object
- Object
- Coopy::TableDiff
- Defined in:
- lib/lib/coopy/table_diff.rb
Instance Method Summary collapse
- #get_comparison_state ⇒ Object
- #get_summary ⇒ Object
- #has_difference ⇒ Object
- #has_schema_difference ⇒ Object
- #hilite(output) ⇒ Object
- #hilite_with_nesting(output) ⇒ Object
-
#initialize(align, flags) ⇒ TableDiff
constructor
A new instance of TableDiff.
- #is_nested ⇒ Object
- #set_cell_builder(builder) ⇒ Object
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_state ⇒ Object
1160 1161 1162 1163 |
# File 'lib/lib/coopy/table_diff.rb', line 1160 def get_comparison_state return nil if @align == nil @align.comp end |
#get_summary ⇒ Object
1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 |
# File 'lib/lib/coopy/table_diff.rb', line 1165 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.different = @row_deletes + @row_inserts + @row_updates + @row_reorders + @col_deletes + @col_inserts + @col_updates + @col_renames + @col_reorders > 0 ds end |
#has_difference ⇒ Object
1148 1149 1150 |
# File 'lib/lib/coopy/table_diff.rb', line 1148 def has_difference @diff_found end |
#has_schema_difference ⇒ Object
1152 1153 1154 |
# File 'lib/lib/coopy/table_diff.rb', line 1152 def has_schema_difference @schema_diff_found end |
#hilite(output) ⇒ Object
993 994 995 996 |
# File 'lib/lib/coopy/table_diff.rb', line 993 def hilite(output) output = ::Coopy::Coopy.tablify(output) self.hilite_single(output) end |
#hilite_with_nesting(output) ⇒ Object
1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 |
# File 'lib/lib/coopy/table_diff.rb', line 1121 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_nested ⇒ Object
1156 1157 1158 |
# File 'lib/lib/coopy/table_diff.rb', line 1156 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 |