Sha256: fd4f29054222de7065513d698fb814b4cfde22fc207f2723bd9d5adf9d1b28de
Contents?: true
Size: 764 Bytes
Versions: 19
Compression:
Stored size: 764 Bytes
Contents
module Mandy module Reducers class Base < Mandy::Task def self.compile(&blk) Class.new(Mandy::Reducers::Base) do self.class_eval do define_method(:reducer, blk) if blk end end end def execute last_key, values = nil, [] @input.each_line do |line| key, value = line.split(KEY_VALUE_SEPERATOR) value.chomp! last_key = key if last_key.nil? if key != last_key reducer(last_key, values) last_key, values = key, [] end values << value end reducer(last_key, values) end private def reducer(key,values) #nil end end end end
Version data entries
19 entries across 19 versions & 1 rubygems