Sha256: 659b0909bacdf8c531395384fbb2b0241a0c00e82fbca43f1aac55e0d55cdfad
Contents?: true
Size: 864 Bytes
Versions: 11
Compression:
Stored size: 864 Bytes
Contents
module DataMapper class Property def to_json_schema_hash(repo) tm = repository(repo).adapter.type_map type_information = tm[type] if type_information.nil? && type.respond_to?(:primitive) type_information = tm[type.primitive] end json_hash = Hash.new json_hash = { "type" => type_information[:primitive] } json_hash.merge!({ "optional" => true }) unless required? json_hash.merge!({ "unique" => true}) if unique? json_hash.merge!({ "position" => @position }) unless @position.nil? json_hash.merge!({ "prefix" => @prefix }) unless @prefix.nil? json_hash.merge!({ "separator" => @separator }) unless @separator.nil? json_hash.merge!( type_information.reject{ |key,value| key == :primitive } ) json_hash end end end
Version data entries
11 entries across 11 versions & 1 rubygems