Module: Ardm::Ar::Serialization::Behavior::ClassMethods

Defined in:
lib/ardm/ar/serialization.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#initialize_attributes(attributes, options = {}) ⇒ Object



106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/ardm/ar/serialization.rb', line 106

def initialize_attributes(attributes, options = {})
  serialized = (options.delete(:serialized) { true }) ? :serialized : :unserialized
  super(attributes, options)

  serialized_attributes.each do |key, coder|
    if attributes.key?(key)
      attributes[key] = Attribute.new(coder, attributes[key], serialized)
    end
  end

  attributes
end