A entry filter that calls a block to perform its check.
This is a boolean processor, so it merely returns true or false based on the filter result. Use this in conjunction with an If processor to actually perform other actions based on the result.
Create a new filter. Provide the block, which should take an entry object as the parameter and return a boolean.
# File lib/sawmill/entry_processor/filter_by_block.rb, line 54 def initialize(&block_) to_filter_entry(&block_) end
# File lib/sawmill/entry_processor/filter_by_block.rb, line 79 def attribute(entry_) @block.call(entry_) end
# File lib/sawmill/entry_processor/filter_by_block.rb, line 67 def begin_record(entry_) @block.call(entry_) end
# File lib/sawmill/entry_processor/filter_by_block.rb, line 71 def end_record(entry_) @block.call(entry_) end
# File lib/sawmill/entry_processor/filter_by_block.rb, line 87 def finish nil end
# File lib/sawmill/entry_processor/filter_by_block.rb, line 75 def message(entry_) @block.call(entry_) end
Provide a block to filter entries. It should take an entry object as the parameter, and return a boolean.
# File lib/sawmill/entry_processor/filter_by_block.rb, line 62 def to_filter_entry(&block_) @block = block_ || Proc.new{ |entry_| false } end
# File lib/sawmill/entry_processor/filter_by_block.rb, line 83 def unknown_data(entry_) @block.call(entry_) end