A boolean processor that returns true if and only if all its child processors return true. This version short-circuits the processing, so once one child returns false, subsequent children are not called at all.
For example, this builds a processor that sends formatted log records to STDOUT only if they have a “user” attribute of “daniel” AND their record ID is ‘12345678’:
processor = Sawmill::RecordProcessor.build do If(And(FilterByAttributes('user' => 'daniel'), FilterByRecordID('12345678')), Format(STDOUT)) end
Create an “and” boolean. The parameters are child processors whose return values should be combined with an AND operation.
# File lib/sawmill/record_processor/conditionals.rb, line 154 def initialize(*children_) @children = _interpret_processor_array(children_) end
# File lib/sawmill/record_processor/conditionals.rb, line 165 def extra_entry(entry_) @children.each do |child_| return false unless child_.extra_entry(entry_) end true end
# File lib/sawmill/record_processor/conditionals.rb, line 172 def finish Util::ProcessorTools.collect_finish_values(@children) end
# File lib/sawmill/record_processor/conditionals.rb, line 158 def record(record_) @children.each do |child_| return false unless child_.record(record_) end true end