Class: FluQ::Input::Base
- Inherits:
-
Object
- Object
- FluQ::Input::Base
- Includes:
- Celluloid::IO, Mixins::Loggable
- Defined in:
- lib/fluq/input/base.rb
Instance Attribute Summary collapse
- #config ⇒ Object readonly
- #worker ⇒ Object readonly
Instance Method Summary collapse
-
#description ⇒ String
Descriptive name.
-
#initialize(source, handlers, options = {}) ⇒ Base
constructor
A new instance of Base.
-
#name ⇒ String
Short name.
-
#process(data) ⇒ Object
Processes data.
-
#run ⇒ Object
Start the input.
Methods included from Mixins::Loggable
Constructor Details
#initialize(source, handlers, options = {}) ⇒ Base
Returns a new instance of Base.
15 16 17 18 19 20 21 22 23 |
# File 'lib/fluq/input/base.rb', line 15 def initialize(source, handlers, = {}) super() @config = defaults.merge() configure @worker = FluQ::Worker.new_link [source, name].join(":"), handlers logger.info "#{source}: listening to #{description}" async.run end |
Instance Attribute Details
#config ⇒ Object (readonly)
7 8 9 |
# File 'lib/fluq/input/base.rb', line 7 def config @config end |
#worker ⇒ Object (readonly)
10 11 12 |
# File 'lib/fluq/input/base.rb', line 10 def worker @worker end |
Instance Method Details
#description ⇒ String
Returns descriptive name.
31 32 33 |
# File 'lib/fluq/input/base.rb', line 31 def description name end |
#name ⇒ String
Returns short name.
26 27 28 |
# File 'lib/fluq/input/base.rb', line 26 def name @name ||= self.class.name.split("::")[-1].downcase end |
#process(data) ⇒ Object
Processes data
41 42 43 |
# File 'lib/fluq/input/base.rb', line 41 def process(data) worker.process format.parse(data) end |
#run ⇒ Object
Start the input
36 37 |
# File 'lib/fluq/input/base.rb', line 36 def run end |