Class: Sawmill::EntryProcessor::Not

Inherits:
Base
  • Object
show all
Defined in:
lib/sawmill/entry_processor/conditionals.rb

Overview

A boolean processor that returns the boolean negation of a given processor.

For example, this builds a processor that sends formatted log entries to STDOUT only if their level is NOT at least INFO:

processor = Sawmill::EntryProcessor.build do If(Not(FilterByBasicFields(:level => :INFO)), Format(STDOUT)) end

Instance Method Summary collapse

Methods inherited from Base

add_dsl_method, inherited

Constructor Details

#initialize(child_) ⇒ Not

Create a "not" boolean. The parameter is a boolean processor to run. This processor returns the boolean negation of its output.



136
137
138
# File 'lib/sawmill/entry_processor/conditionals.rb', line 136

def initialize(child_)
  @child = _interpret_processor(child_)
end

Instance Method Details

#attribute(entry_) ⇒ Object



152
153
154
# File 'lib/sawmill/entry_processor/conditionals.rb', line 152

def attribute(entry_)
  !@child.attribute(entry_)
end

#begin_record(entry_) ⇒ Object



140
141
142
# File 'lib/sawmill/entry_processor/conditionals.rb', line 140

def begin_record(entry_)
  !@child.begin_record(entry_)
end

#end_record(entry_) ⇒ Object



144
145
146
# File 'lib/sawmill/entry_processor/conditionals.rb', line 144

def end_record(entry_)
  !@child.end_record(entry_)
end

#finishObject



160
161
162
# File 'lib/sawmill/entry_processor/conditionals.rb', line 160

def finish
  @child.finish
end

#message(entry_) ⇒ Object



148
149
150
# File 'lib/sawmill/entry_processor/conditionals.rb', line 148

def message(entry_)
  !@child.message(entry_)
end

#unknown_data(entry_) ⇒ Object



156
157
158
# File 'lib/sawmill/entry_processor/conditionals.rb', line 156

def unknown_data(entry_)
  !@child.unknown_data(entry_)
end