Module: Differential

Extended by:
Calculator::Side
Defined in:
lib/differential/version.rb,
lib/differential/parser/id.rb,
lib/differential/differential.rb,
lib/differential/parser/reader.rb,
lib/differential/parser/record.rb,
lib/differential/calculator/item.rb,
lib/differential/calculator/side.rb,
lib/differential/calculator/group.rb,
lib/differential/calculator/report.rb,
lib/differential/calculator/totals.rb,
lib/differential/calculator/has_totals.rb

Overview

Copyright © 2018-present, Blue Marble Payroll, LLC

This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree.

Defined Under Namespace

Modules: Calculator, Parser

Constant Summary collapse

VERSION =
'1.1.0'

Constants included from Calculator::Side

Calculator::Side::A, Calculator::Side::B

Class Method Summary collapse

Class Method Details

.calculate(dataset_a: [], dataset_b: [], reader_config: {}) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/differential/differential.rb', line 22

def calculate(dataset_a: [], dataset_b: [], reader_config: {})
  reader = ::Differential::Parser::Reader.new(reader_config)
  report = ::Differential::Calculator::Report.new

  dataset_a.each { |hash| report.add(reader.read(hash), A) }
  dataset_b.each { |hash| report.add(reader.read(hash), B) }

  report
end