Class: Gruf::Serializers::Errors::Json

Inherits:
Base
  • Object
show all
Defined in:
lib/gruf/serializers/errors/json.rb

Overview

Serializes the error via JSON for transport

Instance Attribute Summary

Attributes inherited from Base

#error

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Gruf::Serializers::Errors::Base

Instance Method Details

#deserializeHash

Returns A hash deserialized from the inputted JSON.

Returns:

  • (Hash)

    A hash deserialized from the inputted JSON



37
38
39
# File 'lib/gruf/serializers/errors/json.rb', line 37

def deserialize
  JSON.parse(@error)
end

#serializeString

Returns The serialized JSON string.

Returns:

  • (String)

    The serialized JSON string



30
31
32
# File 'lib/gruf/serializers/errors/json.rb', line 30

def serialize
  @error.to_h.to_json
end