Module: Sequel::Plugins::Composition::InstanceMethods
- Defined in:
- lib/sequel/plugins/composition.rb
Instance Method Summary collapse
-
#before_save ⇒ Object
For each composition, set the columns in the model class based on the composition object.
-
#compositions ⇒ Object
Cache of composition objects for this class.
-
#freeze ⇒ Object
Freeze compositions hash when freezing model instance.
Instance Method Details
#before_save ⇒ Object
For each composition, set the columns in the model class based on the composition object.
154 155 156 157 |
# File 'lib/sequel/plugins/composition.rb', line 154 def before_save @compositions.keys.each{|n| instance_eval(&model.compositions[n][:decomposer])} if @compositions super end |
#compositions ⇒ Object
Cache of composition objects for this class.
160 161 162 |
# File 'lib/sequel/plugins/composition.rb', line 160 def compositions @compositions ||= {} end |
#freeze ⇒ Object
Freeze compositions hash when freezing model instance.
165 166 167 168 |
# File 'lib/sequel/plugins/composition.rb', line 165 def freeze compositions.freeze super end |