Class: SnitchReporting::Service::JSONWrapper
- Inherits:
-
Object
- Object
- SnitchReporting::Service::JSONWrapper
- Defined in:
- app/models/snitch_reporting/service/json_wrapper.rb
Class Method Summary collapse
-
.dump(obj) ⇒ Object
Allows directly setting pre-stringified JSON.
- .load(str) ⇒ Object
Class Method Details
.dump(obj) ⇒ Object
Allows directly setting pre-stringified JSON.
3 |
# File 'app/models/snitch_reporting/service/json_wrapper.rb', line 3 def self.dump(obj); obj.is_a?(String) ? obj : JSON.dump(obj); end |
.load(str) ⇒ Object
4 |
# File 'app/models/snitch_reporting/service/json_wrapper.rb', line 4 def self.load(str); str.present? ? JSON.parse(str) : str; end |