Class: NATS::JetStream::API::RawStreamMsg

Inherits:
Struct
  • Object
show all
Defined in:
lib/nats/io/js.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ RawStreamMsg

Returns a new instance of RawStreamMsg.



1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
# File 'lib/nats/io/js.rb', line 1290

def initialize(opts)
  opts[:data] = Base64.decode64(opts[:data]) if opts[:data]
  if opts[:hdrs]
    header = Base64.decode64(opts[:hdrs])
    hdr = {}
    lines = header.lines
    lines.slice(1, header.size).each do |line|
      line.rstrip!
      next if line.empty?
      key, value = line.strip.split(/\s*:\s*/, 2)
      hdr[key] = value
    end
    opts[:headers] = hdr
  end

  # Filter out members not present.
  rem = opts.keys - members
  opts.delete_if { |k| rem.include?(k) }
  super(opts)
end

Instance Attribute Details

#dataObject

Returns the value of attribute data

Returns:

  • (Object)

    the current value of data



1289
1290
1291
# File 'lib/nats/io/js.rb', line 1289

def data
  @data
end

#headersObject

Returns the value of attribute headers

Returns:

  • (Object)

    the current value of headers



1289
1290
1291
# File 'lib/nats/io/js.rb', line 1289

def headers
  @headers
end

#seqObject

Returns the value of attribute seq

Returns:

  • (Object)

    the current value of seq



1289
1290
1291
# File 'lib/nats/io/js.rb', line 1289

def seq
  @seq
end

#subjectObject

Returns the value of attribute subject

Returns:

  • (Object)

    the current value of subject



1289
1290
1291
# File 'lib/nats/io/js.rb', line 1289

def subject
  @subject
end

Instance Method Details

#sequenceObject



1311
1312
1313
# File 'lib/nats/io/js.rb', line 1311

def sequence
  self.seq
end