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

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) before_save

Serialize deserialized values before saving



176
177
178
179
# File 'lib/sequel/plugins/serialization.rb', line 176

def before_save
  serialize_deserialized_values
  super
end

- (Object) deserialized_values

Hash of deserialized values, used as a cache.



182
183
184
# File 'lib/sequel/plugins/serialization.rb', line 182

def deserialized_values
  @deserialized_values ||= {}
end

- (Object) dup

Freeze the deserialized values



187
188
189
190
191
192
193
# File 'lib/sequel/plugins/serialization.rb', line 187

def dup
  dv = deserialized_values.dup
  super.instance_eval do
    @deserialized_values = dv
    self
  end
end

- (Object) freeze

Freeze the deserialized values



196
197
198
199
# File 'lib/sequel/plugins/serialization.rb', line 196

def freeze
  deserialized_values.freeze
  super
end