Sha256: 9955e9fa9830f28f9d88c6d0ee442b06a2613f91c90c3012aba662f00d17ad45

Contents?: true

Size: 698 Bytes

Versions: 6

Compression:

Stored size: 698 Bytes

Contents

module Mandy
  module Mappers
    class Base < Mandy::Task
      include Mandy::IO::InputFormatting

      def self.compile(&blk)
        Class.new(Mandy::Mappers::Base) do 
          self.class_eval do
            define_method(:mapper, blk) if blk
          end
        end
      end
      
      def execute
        @input.each_line do |line|
           key, value = line.split(KEY_VALUE_SEPERATOR, 2)
           key, value = nil, key if value.nil?
           value.chomp!
           args = [input_deserialize_key(key), input_deserialize_value(value)].compact
           mapper(*args)
        end
      end

      private
    
      def mapper(key,value)
        #nil
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mandy-0.3.6 lib/mappers/base_mapper.rb
mandy-0.3.5 lib/mappers/base_mapper.rb
mandy-0.3.4 lib/mappers/base_mapper.rb
mandy-0.3.3 lib/mappers/base_mapper.rb
mandy-0.3.2 lib/mappers/base_mapper.rb
mandy-0.3.1 lib/mappers/base_mapper.rb