Class: Spark::Command::Filter

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

Overview


Filter

Instance Method Summary collapse

Instance Method Details

#lazy_run(iterator) ⇒ Object



80
81
82
83
84
# File 'lib/spark/command/basic.rb', line 80

def lazy_run(iterator, *)
  iterator.select do |item|
    @filter_function.call(item)
  end
end

#run(iterator) ⇒ Object



73
74
75
76
77
78
# File 'lib/spark/command/basic.rb', line 73

def run(iterator, *)
  iterator.select! do |item|
    @filter_function.call(item)
  end
  iterator
end