Class: FluQ::Feed
- Inherits:
-
Celluloid::SupervisionGroup
- Object
- Celluloid::SupervisionGroup
- FluQ::Feed
- Defined in:
- lib/fluq/feed.rb
Instance Attribute Summary collapse
- #handlers ⇒ Object readonly
- #name ⇒ Object readonly
Instance Method Summary collapse
-
#initialize(name, &block) ⇒ Feed
constructor
Constructor.
-
#inputs ⇒ Array<FluQ::Input::Base>
Inputs.
-
#inspect ⇒ String
Introspection.
-
#listen(klass, *args) ⇒ Object
Listens to an input.
-
#register(klass, *args) ⇒ Object
Registers a handler.
Constructor Details
#initialize(name, &block) ⇒ Feed
Constructor
11 12 13 14 15 |
# File 'lib/fluq/feed.rb', line 11 def initialize(name, &block) @name = name.to_s @handlers = [] super(&block) end |
Instance Attribute Details
#handlers ⇒ Object (readonly)
7 8 9 |
# File 'lib/fluq/feed.rb', line 7 def handlers @handlers end |
#name ⇒ Object (readonly)
4 5 6 |
# File 'lib/fluq/feed.rb', line 4 def name @name end |
Instance Method Details
#inputs ⇒ Array<FluQ::Input::Base>
Returns inputs.
18 19 20 |
# File 'lib/fluq/feed.rb', line 18 def inputs actors end |
#inspect ⇒ String
Returns introspection.
37 38 39 |
# File 'lib/fluq/feed.rb', line 37 def inspect "#<#{self.class.name}(#{name}) inputs: #{inputs.size}, handlers: #{handlers.size}>" end |
#listen(klass, *args) ⇒ Object
Listens to an input
25 26 27 |
# File 'lib/fluq/feed.rb', line 25 def listen(klass, *args) supervise klass, name, handlers, *args end |
#register(klass, *args) ⇒ Object
Registers a handler
32 33 34 |
# File 'lib/fluq/feed.rb', line 32 def register(klass, *args) handlers.push [klass, *args] end |