Class: RSMP::Event
- Inherits:
-
Data
- Object
- Data
- RSMP::Event
- Defined in:
- lib/rsmp/event.rb
Overview
A typed occurrence produced by a long-running node or connection.
Instance Attribute Summary collapse
-
#at ⇒ Object
readonly
Returns the value of attribute at.
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#failure ⇒ Object
readonly
Returns the value of attribute failure.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#session_id ⇒ Object
readonly
Returns the value of attribute session_id.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type:, source:, session_id: nil, message: nil, failure: nil, context: {}, at: Time.now) ⇒ Event
constructor
A new instance of Event.
Constructor Details
#initialize(type:, source:, session_id: nil, message: nil, failure: nil, context: {}, at: Time.now) ⇒ Event
Returns a new instance of Event.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/rsmp/event.rb', line 4 def initialize(type:, source:, session_id: nil, message: nil, failure: nil, context: {}, at: Time.now) raise ArgumentError, 'event type must be a Symbol' unless type.is_a?(Symbol) raise ArgumentError, 'event context must be a Hash' unless context.is_a?(Hash) super( type: type, source: source, session_id: session_id, message: , failure: failure, context: context.dup.freeze, at: at ) end |
Instance Attribute Details
#at ⇒ Object (readonly)
Returns the value of attribute at
3 4 5 |
# File 'lib/rsmp/event.rb', line 3 def at @at end |
#context ⇒ Object (readonly)
Returns the value of attribute context
3 4 5 |
# File 'lib/rsmp/event.rb', line 3 def context @context end |
#failure ⇒ Object (readonly)
Returns the value of attribute failure
3 4 5 |
# File 'lib/rsmp/event.rb', line 3 def failure @failure end |
#message ⇒ Object (readonly)
Returns the value of attribute message
3 4 5 |
# File 'lib/rsmp/event.rb', line 3 def end |
#session_id ⇒ Object (readonly)
Returns the value of attribute session_id
3 4 5 |
# File 'lib/rsmp/event.rb', line 3 def session_id @session_id end |
#source ⇒ Object (readonly)
Returns the value of attribute source
3 4 5 |
# File 'lib/rsmp/event.rb', line 3 def source @source end |
#type ⇒ Object (readonly)
Returns the value of attribute type
3 4 5 |
# File 'lib/rsmp/event.rb', line 3 def type @type end |