Module: JSONSerializer

Defined in:
lib/right_agent/serialize/serializer.rb

Class Method Summary collapse

Class Method Details

.dump(*args) ⇒ Object



44
45
46
# File 'lib/right_agent/serialize/serializer.rb', line 44

def self.dump(*args)
  JSON.dump(*args)
end

.load(source) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/right_agent/serialize/serializer.rb', line 31

def self.load(source)

  if source.respond_to? :to_str
    source = source.to_str
  elsif source.respond_to? :to_io
    source = source.to_io.read
  else
    source = source.read
  end
  source.force_encoding("UTF-8") if source.respond_to?(:force_encoding)
  JSON.load(source)
end