Class: Queuel::Serialization::Json::Decoder
- Inherits:
-
Object
- Object
- Queuel::Serialization::Json::Decoder
- Defined in:
- lib/queuel/serialization/json.rb
Class Method Summary collapse
Instance Method Summary collapse
- #decode ⇒ Object
-
#initialize(body) ⇒ Decoder
constructor
A new instance of Decoder.
Constructor Details
#initialize(body) ⇒ Decoder
Returns a new instance of Decoder.
11 12 13 |
# File 'lib/queuel/serialization/json.rb', line 11 def initialize(body) @body = body.to_s end |
Class Method Details
.call(body) ⇒ Object
7 8 9 |
# File 'lib/queuel/serialization/json.rb', line 7 def self.call(body) new(body).decode end |
Instance Method Details
#decode ⇒ Object
15 16 17 18 19 |
# File 'lib/queuel/serialization/json.rb', line 15 def decode MultiJson.load @body, symbolize_keys: true rescue MultiJson::LoadError raise SerializationError, "Error reading:\n#{@body}" end |