Class: Spark::Command::Map

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

Overview


Map

Direct Known Subclasses

FlatMap

Instance Method Summary collapse

Instance Method Details

#lazy_run(iterator) ⇒ Object



16
17
18
19
20
# File 'lib/spark/command/basic.rb', line 16

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

#run(iterator) ⇒ Object



9
10
11
12
13
14
# File 'lib/spark/command/basic.rb', line 9

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