Class: Spark::Command::CombineByKey::Combine
- Defined in:
- lib/spark/command/pair.rb
Overview
Constant Summary
Constants inherited from Base
Base::DEFAULT_VARIABLE_OPTIONS
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Methods inherited from Base
#before_run, error, #error, #execute, init_settings, #initialize, #log, #method_missing, #prepare, #prepared?, #settings, settings, #to_s, variable
Constructor Details
This class inherits a constructor from Spark::Command::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Spark::Command::Base
Instance Method Details
#_run(iterator) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/spark/command/pair.rb', line 26 def _run(iterator) # Not use combiners[key] ||= .. # it tests nil and not has_key? combiners = {} iterator.each do |key, value| if combiners.has_key?(key) combiners[key] = @merge_value.call(combiners[key], value) else combiners[key] = @create_combiner.call(value) end end combiners end |