Class: FluQ::Handler::Base
- Inherits:
-
Object
- Object
- FluQ::Handler::Base
- Includes:
- Mixins::Loggable
- Defined in:
- lib/fluq/handler/base.rb
Instance Attribute Summary collapse
- #config ⇒ Object readonly
- #name ⇒ Object readonly
Class Method Summary collapse
-
.type ⇒ String
Handler type.
Instance Method Summary collapse
-
#filter(events) ⇒ Array<FluQ::Event>
Filtered events.
-
#initialize(options = {}) ⇒ Base
constructor
A new instance of Base.
- #on_events(events) ⇒ Object abstract
-
#timers ⇒ Timers
Timers.
Methods included from Mixins::Loggable
Constructor Details
#initialize(options = {}) ⇒ Base
Returns a new instance of Base.
25 26 27 28 |
# File 'lib/fluq/handler/base.rb', line 25 def initialize( = {}) @config = defaults.merge() @name = config[:name] || self.class.type end |
Instance Attribute Details
#config ⇒ Object (readonly)
15 16 17 |
# File 'lib/fluq/handler/base.rb', line 15 def config @config end |
#name ⇒ Object (readonly)
12 13 14 |
# File 'lib/fluq/handler/base.rb', line 12 def name @name end |
Class Method Details
.type ⇒ String
Returns handler type.
7 8 9 |
# File 'lib/fluq/handler/base.rb', line 7 def self.type @type ||= name.split("::")[-1].downcase end |
Instance Method Details
#filter(events) ⇒ Array<FluQ::Event>
Returns filtered events.
32 33 34 |
# File 'lib/fluq/handler/base.rb', line 32 def filter(events) events end |
#on_events(events) ⇒ Object
This method is abstract.
callback, called on each event
43 44 |
# File 'lib/fluq/handler/base.rb', line 43 def on_events(events) end |
#timers ⇒ Timers
Returns timers.
37 38 39 |
# File 'lib/fluq/handler/base.rb', line 37 def timers @timers ||= Timers.new end |