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 : (Fusuma::Plugin::Events::Event) -> Fusuma::Plugin::Events::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 : (Fusuma::Plugin::Events::Event) -> Fusuma::Plugin::Events::Event?
15 16 17 18 19 20 21 |
# File 'lib/fusuma/plugin/filters/filter.rb', line 15 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
27 28 29 |
# File 'lib/fusuma/plugin/filters/filter.rb', line 27 def keep?(record) true if record end |
#source ⇒ Object
Set source for tag from config.yml. DEFAULT_SOURCE is defined in each Filter plugins. : () -> String
34 35 36 |
# File 'lib/fusuma/plugin/filters/filter.rb', line 34 def source @source ||= config_params(:source) || self.class.const_get(:DEFAULT_SOURCE) end |