Class: DefaultContextDataDeserializer

Inherits:
ContextDataDeserializer show all
Defined in:
lib/default_context_data_deserializer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#logObject

Returns the value of attribute log.



8
9
10
# File 'lib/default_context_data_deserializer.rb', line 8

def log
  @log
end

#readerObject

Returns the value of attribute reader.



8
9
10
# File 'lib/default_context_data_deserializer.rb', line 8

def reader
  @reader
end

Instance Method Details

#deserialize(bytes, offset, length) ⇒ Object



10
11
12
13
14
15
# File 'lib/default_context_data_deserializer.rb', line 10

def deserialize(bytes, offset, length)
  parse = JSON.parse(bytes[offset..length], symbolize_names: true)
  @reader = ContextData.new(parse[:experiments])
rescue JSON::ParserError
  nil
end