class Enzymator::Aggregations::MapReduce

Public Class Methods

new(config = {}) click to toggle source
Calls superclass method Enzymator::Aggregations::Base::new
# File lib/enzymator/aggregations/mapreduce.rb, line 5
def initialize(config = {})
  super

  @transformation = begin
    stages = []

    if @config.map || @config.mapping
      stages << Enzymator::Transformations::Functor::Mapping.new({
        map: @config.map || @config.mapping
      })
    end

    stages << Enzymator::Transformations::Foldable::Reduction.new({
      append:  @config.append || @config.reduction,
      empty:   @config.empty
    })

    Enzymator::Transformations::Object::Pipelining.new({
      stages: stages
    })
  end

end