module Workbook::Modules::BookDiffSort
Adds essential diffing and comparing support, as well as diffing entire books
Public Class Methods
included(base)
click to toggle source
# File lib/workbook/modules/diff_sort.rb, line 29 def self.included(base) base.extend(ClassMethods) end
Public Instance Methods
diff(to_workbook, options={:sort=>true,:ignore_headers=>false})
click to toggle source
Diff an entire workbook against another, sheet by sheet
@param [Workbook::Book] to_workbook to compare against @return [Workbook::Book] workbook with compared result
# File lib/workbook/modules/diff_sort.rb, line 37 def diff to_workbook, options={: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, options) end end return diff_template #the template has been filled in the meanwhile, not to use as a template anymore... :) end