class MagicPipe::Envelope

Attributes

body[RW]

Public Class Methods

new(body:, topic:, producer:, time:, mime:) click to toggle source
# 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

Public Instance Methods

==(other) click to toggle source
# File lib/magic_pipe/envelope.rb, line 25
def ==(other)
  as_json == other.as_json
end
as_json(*) click to toggle source
# File lib/magic_pipe/envelope.rb, line 14
def as_json(*)
  {
    body: @body.as_json,
    topic: @topic,
    producer: @producer,
    time: @time,
    mime: @mime,
  }
end