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 entries to STDOUT only if their level is at least INFO AND the progname is is “rails”:
processor = Sawmill::EntryProcessor.build do If(And(FilterByBasicFields(:level => :INFO), FilterByBasicFields(:progname => 'rails')), 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/entry_processor/conditionals.rb, line 190 def initialize(*children_) @children = _interpret_processor_array(children_) end
# File lib/sawmill/entry_processor/conditionals.rb, line 215 def attribute(entry_) @children.each do |child_| return false unless child_.attribute(entry_) end true end
# File lib/sawmill/entry_processor/conditionals.rb, line 194 def begin_record(entry_) @children.each do |child_| return false unless child_.begin_record(entry_) end true end
# File lib/sawmill/entry_processor/conditionals.rb, line 201 def end_record(entry_) @children.each do |child_| return false unless child_.end_record(entry_) end true end
# File lib/sawmill/entry_processor/conditionals.rb, line 229 def finish Util::ProcessorTools.collect_finish_values(@children) end
# File lib/sawmill/entry_processor/conditionals.rb, line 208 def message(entry_) @children.each do |child_| return false unless child_.message(entry_) end true end
# File lib/sawmill/entry_processor/conditionals.rb, line 222 def unknown_data(entry_) @children.each do |child_| return false unless child_.unknown_data(entry_) end true end