Class: RailwayIpc::Handler
- Inherits:
-
Object
- Object
- RailwayIpc::Handler
- Defined in:
- lib/railway_ipc/handler.rb
Class Attribute Summary collapse
-
.block ⇒ Object
readonly
Returns the value of attribute block.
Class Method Summary collapse
Instance Method Summary collapse
Class Attribute Details
.block ⇒ Object (readonly)
Returns the value of attribute block.
6 7 8 |
# File 'lib/railway_ipc/handler.rb', line 6 def block @block end |
Class Method Details
.handle(&block) ⇒ Object
9 10 11 |
# File 'lib/railway_ipc/handler.rb', line 9 def self.handle(&block) @block = block end |
Instance Method Details
#handle(message) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/railway_ipc/handler.rb', line 13 def handle() RailwayIpc.logger.info('Handling message', ()) response = self.class.block.call() if response.success? RailwayIpc.logger.info('Successfully handled message', ()) else RailwayIpc.logger.error('Failed to handle message', ()) end response end |