Module: Sequel::Plugins::Serialization::InstanceMethods
- Defined in:
- lib/sequel/plugins/serialization.rb
Instance Attribute Summary collapse
-
#deserialized_values ⇒ Object
readonly
Hash of deserialized values, used as a cache.
Instance Method Summary collapse
-
#before_save ⇒ Object
Serialize all deserialized values.
-
#initialize(*args, &block) ⇒ Object
Set @deserialized_values to the empty hash.
-
#refresh ⇒ Object
Empty the deserialized values when refreshing.
Instance Attribute Details
#deserialized_values ⇒ Object (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_save ⇒ Object
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 |
#refresh ⇒ Object
Empty the deserialized values when refreshing.
125 126 127 128 |
# File 'lib/sequel/plugins/serialization.rb', line 125 def refresh @deserialized_values = {} super end |