Sha256: 21ec690956c2c00a63c3e2347bda4092ac9e671b9180103bcdea86c555f86883

Contents?: true

Size: 749 Bytes

Versions: 15

Compression:

Stored size: 749 Bytes

Contents

require 'ardm/property'

module Ardm
  class Property
    class Object < Property
      load_as         ::Object
      dump_as         ::Object
      coercion_method :to_object

      # @api semipublic
      def dump(value)
        instance_of?(Object) ? marshal(value) : value
      end

      # @api semipublic
      def load(value)
        typecast(instance_of?(Object) ? unmarshal(value) : value)
      end

      # @api semipublic
      def marshal(value)
        [ Marshal.dump(value) ].pack('m') unless value.nil?
      end

      # @api semipublic
      def unmarshal(value)
        Marshal.load(value.unpack('m').first) unless value.nil?
      end

      # @api private
      def to_child_key
        self.class
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ardm-0.4.0.ar427 lib/ardm/property/object.rb
ardm-0.4.0 lib/ardm/property/object.rb
ardm-0.3.2 lib/ardm/property/object.rb
ardm-0.3.1 lib/ardm/property/object.rb
ardm-0.3.0 lib/ardm/property/object.rb
ardm-0.2.7 lib/ardm/property/object.rb
ardm-0.2.6 lib/ardm/property/object.rb
ardm-0.2.5 lib/ardm/property/object.rb
ardm-0.2.4 lib/ardm/property/object.rb
ardm-0.2.3 lib/ardm/property/object.rb
ardm-0.2.2 lib/ardm/property/object.rb
ardm-0.2.1 lib/ardm/property/object.rb
ardm-0.2.0 lib/ardm/property/object.rb
ardm-0.1.0 lib/ardm/property/object.rb
ardm-0.0.1 lib/ardm/property/object.rb