Sha256: fa57fa739821cdc84c1ea0fe71ac28fbd987c35971ac397810bfa6fc4816853d
Contents?: true
Size: 619 Bytes
Versions: 2
Compression:
Stored size: 619 Bytes
Contents
# encoding: utf-8 require 'dm-core' require 'dm-types/support/dirty_minder' module DataMapper class Property class PgJSON < Text def dump(value) case value when ::NilClass, ::String value when ::Hash, ::Array Oj.dump(value, mode: :compat) else '{}' end end def load(value) case value when ::Hash, ::Array value when ::String Oj.load(value) else {} end end def primitive?(value) value.kind_of?(::String) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dm-pg-json-0.1.1 | lib/dm-pg-json/property/pgjson.rb |
dm-pg-json-0.1.0 | lib/dm-pg-json/property/pgjson.rb |