Class: Mayu::EventStream::Message
- Inherits:
-
Object
- Object
- Mayu::EventStream::Message
- Extended by:
- T::Sig
- Defined in:
- lib/mayu/event_stream.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#event ⇒ Object
readonly
Returns the value of attribute event.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
-
#initialize(event, data = {}) ⇒ Message
constructor
A new instance of Message.
- #to_a ⇒ Object
Constructor Details
#initialize(event, data = {}) ⇒ Message
Returns a new instance of Message.
92 93 94 95 96 |
# File 'lib/mayu/event_stream.rb', line 92 def initialize(event, data = {}) @id = T.let(Nanoid.generate, String) @event = T.let(event.to_s, String) @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
89 90 91 |
# File 'lib/mayu/event_stream.rb', line 89 def data @data end |
#event ⇒ Object (readonly)
Returns the value of attribute event.
87 88 89 |
# File 'lib/mayu/event_stream.rb', line 87 def event @event end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
85 86 87 |
# File 'lib/mayu/event_stream.rb', line 85 def id @id end |
Instance Method Details
#to_a ⇒ Object
99 100 101 |
# File 'lib/mayu/event_stream.rb', line 99 def to_a [@id, @event, @data] end |