Module: Riak::Serializers::ApplicationXGZIP
Instance Method Summary collapse
Instance Method Details
#dump(object) ⇒ Object
70 71 72 73 74 75 76 77 78 |
# File 'lib/rico.rb', line 70 def dump(object) json = ApplicationJSON.dump(object) io = StringIO.new gz = Zlib::GzipWriter.new(io) gz.write(json) gz.close io.string end |
#load(string) ⇒ Object
80 81 82 83 84 85 86 87 |
# File 'lib/rico.rb', line 80 def load(string) io = StringIO.new(string) gz = Zlib::GzipReader.new(io) json = gz.read gz.close ApplicationJSON.load(json) end |