Class: SnitchReporting::Service::JSONWrapper

Inherits:
Object
  • Object
show all
Defined in:
app/models/snitch_reporting/service/json_wrapper.rb

Class Method Summary collapse

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