Class: Fusuma::Plugin::Filters::Filter
- Defined in:
- lib/fusuma/plugin/filters/filter.rb
Overview
Filter to keep/discard events from input plugin
Direct Known Subclasses
Instance Method Summary collapse
-
#filter(event) ⇒ Event, NilClass
Filter input event.
- #keep?(record) ⇒ True, False abstract
-
#source ⇒ Object
Set source for tag from config.yml.
Methods inherited from Base
#config_index, #config_param_types, #config_params, inherited, plugins, #shutdown
Instance Method Details
#filter(event) ⇒ Event, NilClass
Filter input event
14 15 16 17 18 19 20 |
# File 'lib/fusuma/plugin/filters/filter.rb', line 14 def filter(event) return event if !/#{source}/.match?(event.tag) return event if keep?(event.record) nil end |
#keep?(record) ⇒ True, False
This method is abstract.
override ‘#keep?` to implement
26 27 28 |
# File 'lib/fusuma/plugin/filters/filter.rb', line 26 def keep?(record) true if record end |
#source ⇒ Object
Set source for tag from config.yml. DEFAULT_SOURCE is defined in each Filter plugins.
32 33 34 |
# File 'lib/fusuma/plugin/filters/filter.rb', line 32 def source @source ||= config_params(:source) || self.class.const_get(:DEFAULT_SOURCE) end |