Sha256: d8749aaa69d045fe0ff84dd4ad868f8515fd0cff863e459c0dca24e9a2966ac9

Contents?: true

Size: 450 Bytes

Versions: 22

Compression:

Stored size: 450 Bytes

Contents

require "base64"

module DataMapper
  module Types
    class Object < DataMapper::Type
      primitive String
      size 65535
      lazy true
      track :hash

      def self.typecast(value, property)
        value
      end

      def self.dump(value, property)
        Base64.encode64(Marshal.dump(value))
      end

      def self.load(value, property)
        value.nil? ? nil : Marshal.load(Base64.decode64(value))
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 6 rubygems

Version Path
mack-data_mapper-0.8.3.1 lib/gems/dm-core-0.9.9/lib/dm-core/types/object.rb
mack-data_mapper-0.8.3 lib/gems/dm-core-0.9.9/lib/dm-core/types/object.rb