Class: RSpecTracer::Storage::Serializer::Json Private

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec_tracer/storage/serializer/json.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Default serializer for JsonBackend. Produces pretty-printed JSON strings; reads tolerate binary-mode bytes by forcing UTF-8 on decode (preserves the fix for example titles with non-ASCII bytes on US-ASCII-defaulted filesystems).

Class-level methods (not module_function) so mutant-rspec can observe mutations through the call path; see the mutation- friendly-modules memo.

Class Method Summary collapse

Class Method Details

.decode(bytes) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Internal helper for the tracer pipeline.



35
36
37
# File 'lib/rspec_tracer/storage/serializer/json.rb', line 35

def self.decode(bytes)
  ::JSON.parse(bytes.dup.force_encoding('UTF-8'))
end

.encode(payload) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Internal helper for the tracer pipeline.



29
30
31
# File 'lib/rspec_tracer/storage/serializer/json.rb', line 29

def self.encode(payload)
  ::JSON.pretty_generate(payload)
end

.extensionObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Internal helper for the tracer pipeline.



23
24
25
# File 'lib/rspec_tracer/storage/serializer/json.rb', line 23

def self.extension
  'json'
end