Sha256: 1eba36909f8131fb0ad07dbf7d7a7bbe151e38c2a06091569d2dccc574ac84a6

Contents?: true

Size: 900 Bytes

Versions: 1

Compression:

Stored size: 900 Bytes

Contents

module DataMapper
  module Persevere
    module JSONSupport
      module Property
        def to_json_hash(repo)
          tm = repository(repo).adapter.type_map
          type_information = tm[primitive]
          
          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 # Property
    end # JSON
  end # Persevere
end # DataMapper

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dm-persevere-adapter-0.72.0 lib/persevere_adapter/json_support/property.rb