Class: Shale::Adapter::JSON
- Inherits:
-
Object
- Object
- Shale::Adapter::JSON
- Defined in:
- lib/shale/adapter/json.rb
Overview
JSON adapter
Class Method Summary collapse
-
.dump(obj, **options) ⇒ String
private
Serialize Hash into JSON.
-
.load(json, **options) ⇒ Hash
private
Parse JSON into Hash.
Class Method Details
.dump(obj, **options) ⇒ String
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.
Serialize Hash into JSON
31 32 33 34 35 36 37 38 39 |
# File 'lib/shale/adapter/json.rb', line 31 def self.dump(obj, **) = .except(:pretty) if [:pretty] ::JSON.pretty_generate(obj, **) else ::JSON.generate(obj, **) end end |
.load(json, **options) ⇒ Hash
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.
Parse JSON into Hash
19 20 21 |
# File 'lib/shale/adapter/json.rb', line 19 def self.load(json, **) ::JSON.parse(json, **) end |