Class: Gruf::Serializers::Errors::Json
- Defined in:
- lib/gruf/serializers/errors/json.rb
Overview
Serializes the error via JSON for transport
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#deserialize ⇒ Hash
A hash deserialized from the inputted JSON.
-
#serialize ⇒ String
The serialized JSON string.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Gruf::Serializers::Errors::Base
Instance Method Details
#deserialize ⇒ Hash
Returns A hash deserialized from the inputted JSON.
36 37 38 |
# File 'lib/gruf/serializers/errors/json.rb', line 36 def deserialize JSON.parse(@error) end |
#serialize ⇒ String
Returns The serialized JSON string.
29 30 31 |
# File 'lib/gruf/serializers/errors/json.rb', line 29 def serialize @error.to_h.to_json end |