class Sawmill::EntryProcessor::FilterByMessage

A basic filter that knows how to check message content.

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.

Public Class Methods

new(content_, opts_={}) click to toggle source

Create a new filter. you must provide content, which can be a string or a regex.

Recognized options include:

:accept_non_messages

If set to true, accepts entries that are not messages. Otherwise, if set to false or not specified, rejects such entries.

# File lib/sawmill/entry_processor/filter_by_message.rb, line 60
def initialize(content_, opts_={})
  @content = content_
  @accept_non_messages = opts_[:accept_non_messages] ? true : false
end

Public Instance Methods

attribute(entry_) click to toggle source
# File lib/sawmill/entry_processor/filter_by_message.rb, line 78
def attribute(entry_)
  @accept_non_messages
end
begin_record(entry_) click to toggle source
# File lib/sawmill/entry_processor/filter_by_message.rb, line 66
def begin_record(entry_)
  @accept_non_messages
end
end_record(entry_) click to toggle source
# File lib/sawmill/entry_processor/filter_by_message.rb, line 70
def end_record(entry_)
  @accept_non_messages
end
finish() click to toggle source
# File lib/sawmill/entry_processor/filter_by_message.rb, line 86
def finish
  nil
end
message(entry_) click to toggle source
# File lib/sawmill/entry_processor/filter_by_message.rb, line 74
def message(entry_)
  @content === entry_.message
end
unknown_data(entry_) click to toggle source
# File lib/sawmill/entry_processor/filter_by_message.rb, line 82
def unknown_data(entry_)
  @accept_non_messages
end