Sha256: 9978da49bfe70c0f4cf6d488f01f4902db1ef55b26d7fcb6c44779eb279ee938
Contents?: true
Size: 430 Bytes
Versions: 2
Compression:
Stored size: 430 Bytes
Contents
class Samsara::Serializer def self.dump(arg) case arg when Hash arg.to_json else arg end end def self.load(arg) case arg when String load JSON.parse(arg) when Hash symbolize_keys! arg else arg end end def self.symbolize_keys!(arg) return arg unless arg.is_a? Hash arg.values.each{|val| symbolize_keys! val } arg.symbolize_keys! end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
samsara-0.0.3 | lib/samsara/serializer.rb |
samsara-0.0.2 | lib/samsara/serializer.rb |