Class: EventHub::Handler
- Inherits:
-
Object
- Object
- EventHub::Handler
- Includes:
- ActiveSupport::Callbacks
- Defined in:
- lib/event_hub/handler.rb
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Class Method Summary collapse
Instance Method Summary collapse
- #handle ⇒ Object
-
#initialize(message) ⇒ Handler
constructor
A new instance of Handler.
- #on_incorrect_version ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(message) ⇒ Handler
Returns a new instance of Handler.
23 24 25 |
# File 'lib/event_hub/handler.rb', line 23 def initialize() = end |
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message.
8 9 10 |
# File 'lib/event_hub/handler.rb', line 8 def end |
Class Method Details
.version(version = nil) ⇒ Object
18 19 20 21 |
# File 'lib/event_hub/handler.rb', line 18 def self.version(version = nil) @version = version if version @version end |
Instance Method Details
#handle ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/event_hub/handler.rb', line 10 def handle run_callbacks :handle do validate! call .ack end end |
#on_incorrect_version ⇒ Object
27 28 29 |
# File 'lib/event_hub/handler.rb', line 27 def on_incorrect_version raise IncorrectVersion end |
#validate! ⇒ Object
31 32 33 |
# File 'lib/event_hub/handler.rb', line 31 def validate! on_incorrect_version if .version != self.class.version end |