Class: Spark::Command::MapValues

Inherits:
Object
  • Object
show all
Defined in:
lib/spark/command/pair.rb

Overview


MapValues

Instance Method Summary collapse

Instance Method Details

#lazy_run(iterator) ⇒ Object



99
100
101
102
103
104
# File 'lib/spark/command/pair.rb', line 99

def lazy_run(iterator, *)
  iterator.map do |item|
    item[1] = @map_function.call(item[1])
    item
  end
end

#run(iterator) ⇒ Object



91
92
93
94
95
96
97
# File 'lib/spark/command/pair.rb', line 91

def run(iterator, *)
  iterator.map! do |item|
    item[1] = @map_function.call(item[1])
    item
  end
  iterator
end