Class: Sqrewdriver::Serdes::JSONSerde
- Inherits:
-
Object
- Object
- Sqrewdriver::Serdes::JSONSerde
- Defined in:
- lib/sqrewdriver/serdes/json_serde.rb
Defined Under Namespace
Classes: JSONWrapper
Instance Method Summary collapse
- #dump(val) ⇒ Object
-
#initialize(backend: :json, serialize_options: {}, deserialize_options: {}) ⇒ JSONSerde
constructor
A new instance of JSONSerde.
- #load(val) ⇒ Object
Constructor Details
#initialize(backend: :json, serialize_options: {}, deserialize_options: {}) ⇒ JSONSerde
Returns a new instance of JSONSerde.
14 15 16 17 18 |
# File 'lib/sqrewdriver/serdes/json_serde.rb', line 14 def initialize(backend: :json, serialize_options: {}, deserialize_options: {}) @serialize_options = @deserialize_options = @backend = lookup_json_backend(backend) end |
Instance Method Details
#dump(val) ⇒ Object
20 21 22 |
# File 'lib/sqrewdriver/serdes/json_serde.rb', line 20 def dump(val) @backend.dump(val, **@serialize_options) end |
#load(val) ⇒ Object
24 25 26 |
# File 'lib/sqrewdriver/serdes/json_serde.rb', line 24 def load(val) @backend.load(val, **@deserialize_options) end |