Sha256: 8e33639472f7bf6aebf705480358875cbc38e0e92c164262e57c13c9434b28da

Contents?: true

Size: 648 Bytes

Versions: 13

Compression:

Stored size: 648 Bytes

Contents

module Mandy
  class Task
    KEY_VALUE_SEPERATOR = "\t" unless defined?(KEY_VALUE_SEPERATOR)
  
    def initialize(input=STDIN, output=STDOUT)
      @input, @output = input, output
    end
  
    def emit(key, value=nil)
      key = 'nil' if key.nil?
      @output.puts(value.nil? ? key.to_s : "#{serialize(key)}\t#{serialize(value)}")
    end
    
    def get(store, key)
      Mandy.stores[store].get(key)
    end
    
    def put(store, key, values)
      Mandy.stores[store].put(key, values)
    end
  
    private

    
    def serialize(value)
      value = ArraySerializer.new(value) if value.is_a?(Array)
      value.to_s
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
trafficbroker-mandy-0.1.8 lib/task.rb
trafficbroker-mandy-0.1.9 lib/task.rb
trafficbroker-mandy-0.2.2 lib/task.rb
trafficbroker-mandy-0.2.3 lib/task.rb
trafficbroker-mandy-0.2.4.2 lib/task.rb
trafficbroker-mandy-0.2.4.3 lib/task.rb
trafficbroker-mandy-0.2.4.4 lib/task.rb
trafficbroker-mandy-0.2.4.5 lib/task.rb
trafficbroker-mandy-0.2.4.6 lib/task.rb
trafficbroker-mandy-0.2.4 lib/task.rb
trafficbroker-mandy-0.2.5.1 lib/task.rb
trafficbroker-mandy-0.2.5 lib/task.rb
trafficbroker-mandy-0.2 lib/task.rb