Module: Sequel::Plugins::Serialization::InstanceMethods

Defined in:
lib/sequel/plugins/serialization.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#deserialized_valuesObject (readonly)

Hash of deserialized values, used as a cache.



110
111
112
# File 'lib/sequel/plugins/serialization.rb', line 110

def deserialized_values
  @deserialized_values
end

Instance Method Details

#before_saveObject

Serialize all deserialized values



119
120
121
122
# File 'lib/sequel/plugins/serialization.rb', line 119

def before_save
  deserialized_values.each{|k,v| @values[k] = serialize_value(k, v)}
  super
end

#initialize(*args, &block) ⇒ Object

Set @deserialized_values to the empty hash



113
114
115
116
# File 'lib/sequel/plugins/serialization.rb', line 113

def initialize(*args, &block)
  @deserialized_values = {}
  super
end

#refreshObject

Empty the deserialized values when refreshing.



125
126
127
128
# File 'lib/sequel/plugins/serialization.rb', line 125

def refresh
  @deserialized_values = {}
  super
end