Module: Workbook::Modules::BookDiffSort
- Included in:
- Book
- Defined in:
- lib/workbook/modules/diff_sort.rb
Overview
Adds essential diffing and comparing support, as well as diffing entire books
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
-
#diff(to_workbook, options = {:sort=>true,:ignore_headers=>false}) ⇒ Workbook::Book
Diff an entire workbook against another, sheet by sheet.
Class Method Details
.included(base) ⇒ Object
29 30 31 |
# File 'lib/workbook/modules/diff_sort.rb', line 29 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#diff(to_workbook, options = {:sort=>true,:ignore_headers=>false}) ⇒ Workbook::Book
Diff an entire workbook against another, sheet by sheet
37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/workbook/modules/diff_sort.rb', line 37 def diff to_workbook, ={:sort=>true,:ignore_headers=>false} diff_template = Workbook::Book.new_diff_template self.each_with_index do |from_sheet, sheet_index| to_sheet = to_workbook[sheet_index] if to_sheet from_table = from_sheet.table to_table = to_sheet.table diff_table_template = diff_template.create_or_open_sheet_at(sheet_index).table from_table.diff_template = diff_table_template from_table.diff(to_table, ) end end return diff_template #the template has been filled in the meanwhile, not to use as a template anymore... :) end |