# encoding: utf-8 require 'dm-core' require 'dm-types/support/dirty_minder' module DataMapper class Property class PgJSON < Object 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