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

Instance Method Summary collapse

Instance Attribute Details

#__store_configurable_owner__Object

Returns the value of attribute store_configurable_owner.



9
10
11
# File 'lib/store_configurable/serialization.rb', line 9

def __store_configurable_owner__
  @__store_configurable_owner__
end

Instance Method Details

#unserializeObject



11
12
13
14
# File 'lib/store_configurable/serialization.rb', line 11

def unserialize
  self.state = :unserialized
  self.value = coder.load(value, __store_configurable_owner__)
end