Class: DataMapper::Property::Object
- Inherits:
-
DataMapper::Property
- Object
- DataMapper::Property
- DataMapper::Property::Object
- Defined in:
- lib/dm-core/property/object.rb
Constant Summary
Constants inherited from DataMapper::Property
OPTIONS, PRIMITIVES, VISIBILITY_OPTIONS
Instance Attribute Summary
Attributes inherited from DataMapper::Property
#allow_blank, #allow_nil, #default, #instance_variable_name, #model, #name, #options, #primitive, #reader_visibility, #repository_name, #required, #type, #writer_visibility
Instance Method Summary collapse
Methods inherited from DataMapper::Property
accept_options, accepted_options, #allow_blank?, #allow_nil?, #bind, #custom?, descendants, determine_class, #field, find_class, #get, #get!, #hash, #index, inherited, #inspect, #key?, #lazy?, #lazy_load, #lazy_load_properties, #loaded?, nullable, options, #primitive?, #properties, #required?, #serial?, #set, #set!, #typecast, #unique?, #unique_index, #valid?
Methods included from Chainable
Methods included from Deprecate
Methods included from Equalizer
Methods included from Subject
Methods included from Assertions
Instance Method Details
#dump(value) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/dm-core/property/object.rb', line 7 def dump(value) return value if value.nil? if @type @type.dump(value, self) else [ Marshal.dump(value) ].pack('m') end end |
#load(value) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/dm-core/property/object.rb', line 18 def load(value) if @type return @type.load(value, self) end case value when ::String Marshal.load(value.unpack('m').first) when ::Object value end end |
#to_child_key ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
32 33 34 |
# File 'lib/dm-core/property/object.rb', line 32 def to_child_key self.class end |