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

Inherits:
Struct show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/nats-pure-2.2.1/lib/nats/io/jetstream/api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Struct

#as_json

Constructor Details

#initialize(opts) ⇒ RawStreamMsg

Returns a new instance of RawStreamMsg.



278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/nats-pure-2.2.1/lib/nats/io/jetstream/api.rb', line 278

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



277
278
279
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/nats-pure-2.2.1/lib/nats/io/jetstream/api.rb', line 277

def data
  @data
end

#headersObject

Returns the value of attribute headers

Returns:

  • (Object)

    the current value of headers



277
278
279
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/nats-pure-2.2.1/lib/nats/io/jetstream/api.rb', line 277

def headers
  @headers
end

#seqObject

Returns the value of attribute seq

Returns:

  • (Object)

    the current value of seq



277
278
279
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/nats-pure-2.2.1/lib/nats/io/jetstream/api.rb', line 277

def seq
  @seq
end

#subjectObject

Returns the value of attribute subject

Returns:

  • (Object)

    the current value of subject



277
278
279
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/nats-pure-2.2.1/lib/nats/io/jetstream/api.rb', line 277

def subject
  @subject
end

Instance Method Details

#sequenceObject



299
300
301
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/nats-pure-2.2.1/lib/nats/io/jetstream/api.rb', line 299

def sequence
  self.seq
end