Class: Rulix::Mutator

Inherits:
Object
  • Object
show all
Includes:
Registry
Defined in:
lib/rulix/mutator.rb

Class Method Summary collapse

Methods included from Registry

included

Class Method Details

.run(dataset, ruleset) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/rulix/mutator.rb', line 7

def self.run dataset, ruleset
  dataset.deep_merge ruleset do |key, val1, val2|
    val2 = [val2] unless val2.is_a? Array

    ops = get_operations val2

    ops.reduce(val1) { |val, op| op.call(val) }
  end
end