Class: ArcFurnace::BlockFilter
- Defined in:
- lib/arc-furnace/block_filter.rb
Instance Attribute Summary
Attributes inherited from Node
#error_handler, #node_id, #params
Instance Method Summary collapse
- #filter(row) ⇒ Object
-
#initialize(source:, block:) ⇒ BlockFilter
constructor
A new instance of BlockFilter.
Methods inherited from Filter
Methods inherited from Source
#advance, #close, #empty?, #finalize, #prepare, #row, #value
Constructor Details
#initialize(source:, block:) ⇒ BlockFilter
Returns a new instance of BlockFilter.
7 8 9 10 11 |
# File 'lib/arc-furnace/block_filter.rb', line 7 def initialize(source:, block:) raise 'Must specify a block' if block.nil? @block = block super(source: source) end |
Instance Method Details
#filter(row) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/arc-furnace/block_filter.rb', line 13 def filter(row) if block.arity == 2 block.call(row, params) else block.call(row) end end |