Module: StoreConfigurable::Serialization
- Defined in:
- lib/store_configurable/serialization.rb
Overview
This module’s behavior is injected into ActiveRecord::AttributeMethods::Serialization::Attribute
class which is a mini state machine for serialized objects. It allows us to both set the store’s owner as well as overwrite the unserialize
method to give the coder both the YAML and owner context. This is done via the _config
attribute reader override.
Instance Attribute Summary collapse
-
#__store_configurable_owner__ ⇒ Object
Returns the value of attribute store_configurable_owner.
Instance Method Summary collapse
Instance Attribute Details
#__store_configurable_owner__ ⇒ Object
Returns the value of attribute store_configurable_owner.
10 11 12 |
# File 'lib/store_configurable/serialization.rb', line 10 def __store_configurable_owner__ @__store_configurable_owner__ end |
Instance Method Details
#unserialize(v) ⇒ Object
12 13 14 15 |
# File 'lib/store_configurable/serialization.rb', line 12 def unserialize(v) self.state = :unserialized self.value = coder.load(v, __store_configurable_owner__) end |