Class: Mandy::Task
- Inherits:
-
Object
- Object
- Mandy::Task
- Defined in:
- lib/mandy/task.rb
Direct Known Subclasses
Constant Summary collapse
- KEY_VALUE_SEPERATOR =
"\t"
- NUMERIC_PADDING =
16
- DEFAULT_COUNTER_GROUP =
'Mandy Counters'
Instance Attribute Summary collapse
-
#input_format ⇒ Object
readonly
Returns the value of attribute input_format.
-
#output_format ⇒ Object
readonly
Returns the value of attribute output_format.
Instance Method Summary collapse
- #emit(key, value = nil) ⇒ Object
- #get(store, key) ⇒ Object
-
#initialize(input = STDIN, output = STDOUT, input_format = nil, output_format = nil) ⇒ Task
constructor
A new instance of Task.
- #put(store, key, values) ⇒ Object
Constructor Details
#initialize(input = STDIN, output = STDOUT, input_format = nil, output_format = nil) ⇒ Task
Returns a new instance of Task.
9 10 11 12 |
# File 'lib/mandy/task.rb', line 9 def initialize(input=STDIN, output=STDOUT, input_format = nil, output_format = nil) @input, @output = input, output @input_format, @output_format = input_format, output_format end |
Instance Attribute Details
#input_format ⇒ Object (readonly)
Returns the value of attribute input_format.
7 8 9 |
# File 'lib/mandy/task.rb', line 7 def input_format @input_format end |
#output_format ⇒ Object (readonly)
Returns the value of attribute output_format.
7 8 9 |
# File 'lib/mandy/task.rb', line 7 def output_format @output_format end |
Instance Method Details
#emit(key, value = nil) ⇒ Object
14 15 16 17 |
# File 'lib/mandy/task.rb', line 14 def emit(key, value=nil) data = value.nil? ? key.to_s : "#{output_serialize_key(key)}\t#{output_serialize_value(value)}" @output.puts data.chomp end |