Class: Airbrush::Handler
Instance Attribute Summary collapse
-
#processor ⇒ Object
readonly
Returns the value of attribute processor.
-
#publisher ⇒ Object
readonly
Returns the value of attribute publisher.
Instance Method Summary collapse
-
#initialize(processor, publisher) ⇒ Handler
constructor
A new instance of Handler.
- #process(id, command, args) ⇒ Object
Constructor Details
#initialize(processor, publisher) ⇒ Handler
Returns a new instance of Handler.
5 6 7 8 9 10 11 |
# File 'lib/airbrush/handler.rb', line 5 def initialize(processor, publisher) raise ArgumentError, 'no processor specified' unless processor raise ArgumentError, 'no publisher specified' unless publisher @processor = processor @publisher = publisher end |
Instance Attribute Details
#processor ⇒ Object (readonly)
Returns the value of attribute processor.
3 4 5 |
# File 'lib/airbrush/handler.rb', line 3 def processor @processor end |
#publisher ⇒ Object (readonly)
Returns the value of attribute publisher.
3 4 5 |
# File 'lib/airbrush/handler.rb', line 3 def publisher @publisher end |
Instance Method Details
#process(id, command, args) ⇒ Object
13 14 15 |
# File 'lib/airbrush/handler.rb', line 13 def process(id, command, args) @publisher.publish id, @processor.dispatch(command, args) end |