A boolean processor that returns true if and only if any of its child processors returns true. This version short-circuits the processing, so once one child returns true, 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 OR the progname is “rails”:
processor = Sawmill::EntryProcessor.build do If(Or(FilterByBasicFields(:level => :INFO), FilterByBasicFields(:progname => 'rails')), Format(STDOUT)) end
Create an “or” boolean. The parameters are child processors whose return values should be combined with an OR operation.
# File lib/sawmill/entry_processor/conditionals.rb, line 259 def initialize(*children_) @children = _interpret_processor_array(children_) end
# File lib/sawmill/entry_processor/conditionals.rb, line 284 def attribute(entry_) @children.each do |child_| return true if child_.attribute(entry_) end false end
# File lib/sawmill/entry_processor/conditionals.rb, line 263 def begin_record(entry_) @children.each do |child_| return true if child_.begin_record(entry_) end false end
# File lib/sawmill/entry_processor/conditionals.rb, line 270 def end_record(entry_) @children.each do |child_| return true if child_.end_record(entry_) end false end
# File lib/sawmill/entry_processor/conditionals.rb, line 298 def finish Util::ProcessorTools.collect_finish_values(@children) end
# File lib/sawmill/entry_processor/conditionals.rb, line 277 def message(entry_) @children.each do |child_| return true if child_.message(entry_) end false end
# File lib/sawmill/entry_processor/conditionals.rb, line 291 def unknown_data(entry_) @children.each do |child_| return true if child_.unknown_data(entry_) end false end