Class: MagicPipe::Envelope
- Inherits:
-
Object
- Object
- MagicPipe::Envelope
- Defined in:
- lib/magic_pipe/envelope.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #as_json ⇒ Object
-
#initialize(body:, topic:, producer:, time:, mime:) ⇒ Envelope
constructor
A new instance of Envelope.
Constructor Details
#initialize(body:, topic:, producer:, time:, mime:) ⇒ Envelope
Returns a new instance of Envelope.
3 4 5 6 7 8 9 |
# File 'lib/magic_pipe/envelope.rb', line 3 def initialize(body:, topic:, producer:, time:, mime:) @body = body @topic = topic @producer = producer @time = time.to_i @mime = mime end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
11 12 13 |
# File 'lib/magic_pipe/envelope.rb', line 11 def body @body end |
Instance Method Details
#==(other) ⇒ Object
25 26 27 |
# File 'lib/magic_pipe/envelope.rb', line 25 def ==(other) as_json == other.as_json end |
#as_json ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/magic_pipe/envelope.rb', line 14 def as_json(*) { body: @body.as_json, topic: @topic, producer: @producer, time: @time, mime: @mime, } end |