Class: Chicago::Flow::Filter

Inherits:
Transformation show all
Defined in:
lib/chicago/flow/filter.rb

Instance Method Summary collapse

Methods inherited from Transformation

#added_fields, adds_fields, #applies_to_stream?, #downstream_fields, #flush, #output_streams, #process, #removed_fields, removes_fields, #upstream_fields

Constructor Details

#initialize(stream = :default, &block) ⇒ Filter

Returns a new instance of Filter.



4
5
6
7
# File 'lib/chicago/flow/filter.rb', line 4

def initialize(stream=:default, &block)
  super(stream)
  @block = block || lambda {|row| false }
end

Instance Method Details

#process_row(row) ⇒ Object



9
10
11
# File 'lib/chicago/flow/filter.rb', line 9

def process_row(row)
  row if @block.call(row)
end