class Spark::Command::CombineByKey::CombineWithZero
Public Instance Methods
_run(iterator)
click to toggle source
# File lib/spark/command/pair.rb, line 65 def _run(iterator) # Not use combiners[key] ||= .. # it tests nil and not has_key? combiners = {} iterator.each do |key, value| unless combiners.has_key?(key) combiners[key] = @zero_value end combiners[key] = @merge_value.call(combiners[key], value) end combiners end