Sha256: e0c6fa96738ec63319fe0dd8d52cc7762a0e756a1660ec4f29a84f4c840b6273
Contents?: true
Size: 493 Bytes
Versions: 1
Compression:
Stored size: 493 Bytes
Contents
module ArJsonSerialize module Serializer extend self def load(s) if s.present? result = ::MultiJson.load(s) rescue s case result when ::Hash ::Hashie::Mash.new(result) when ::Array result.map do |item| item.is_a?(::Hash) ? ::Hashie::Mash.new(item) : item end else result end else '' end end def dump(s) ::MultiJson.dump(s) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ar_json_serialize-0.0.2 | lib/ar_json_serialize/serializer.rb |