From 5f3f2e4e45641ab5fb43e1ca547b8655e95e98f1 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Tue, 16 Jan 2018 09:15:51 +0100 Subject: [PATCH] Added generic Sequencer Unit to have a statistics diff with a custom key. --- .../model/statistics/diff/custom_key.rb | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 lib/sequencer/unit/import/common/model/statistics/diff/custom_key.rb diff --git a/lib/sequencer/unit/import/common/model/statistics/diff/custom_key.rb b/lib/sequencer/unit/import/common/model/statistics/diff/custom_key.rb new file mode 100644 index 000000000..0ad3c3be7 --- /dev/null +++ b/lib/sequencer/unit/import/common/model/statistics/diff/custom_key.rb @@ -0,0 +1,33 @@ +require 'sequencer/unit/import/common/model/statistics/mixin/action_diff' + +class Sequencer + class Unit + module Import + module Common + module Model + module Statistics + module Diff + class CustomKey < Sequencer::Unit::Base + include ::Sequencer::Unit::Import::Common::Model::Statistics::Mixin::ActionDiff + + def process + state.provide(:statistics_diff) do + { + key => diff, + } + end + end + + private + + def key + raise "Missing implementation of method 'key' for class #{self.class.name}" + end + end + end + end + end + end + end + end +end