Class: SDM::ReplayChunk

Inherits:
Object
  • Object
show all
Defined in:
lib/models/porcelain.rb

Overview

A ReplayChunk represents a single "chunk" of data from the query replay.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data: nil, events: nil) ⇒ ReplayChunk

Returns a new instance of ReplayChunk.



10172
10173
10174
10175
10176
10177
10178
# File 'lib/models/porcelain.rb', line 10172

def initialize(
  data: nil,
  events: nil
)
  @data = data == nil ? "" : data
  @events = events == nil ? [] : events
end

Instance Attribute Details

#dataObject

The raw data of the ReplayChunk. The data is encrypted if the associated Query is encrypted.



10167
10168
10169
# File 'lib/models/porcelain.rb', line 10167

def data
  @data
end

#eventsObject

The list of events of the ReplayChunk. If the Query is encrypted, this field is always empty and the events can be obtained by decrypting the data using the QueryKey returned with the Query.



10170
10171
10172
# File 'lib/models/porcelain.rb', line 10170

def events
  @events
end

Instance Method Details

#to_json(options = {}) ⇒ Object



10180
10181
10182
10183
10184
10185
10186
# File 'lib/models/porcelain.rb', line 10180

def to_json(options = {})
  hash = {}
  self.instance_variables.each do |var|
    hash[var.id2name.delete_prefix("@")] = self.instance_variable_get var
  end
  hash.to_json
end