Module: Sequel::Plugins::Composition::InstanceMethods
- Defined in:
- lib/sequel/plugins/composition.rb
Instance Method Summary collapse
-
#_refresh(ds) ⇒ Object
Clear the cached compositions when refreshing.
-
#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.
Instance Method Details
#_refresh(ds) ⇒ Object
Clear the cached compositions when refreshing.
152 153 154 155 |
# File 'lib/sequel/plugins/composition.rb', line 152 def _refresh(ds) super compositions.clear end |
#before_save ⇒ Object
For each composition, set the columns in the model class based on the composition object.
159 160 161 162 |
# File 'lib/sequel/plugins/composition.rb', line 159 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.
165 166 167 |
# File 'lib/sequel/plugins/composition.rb', line 165 def compositions @compositions ||= {} end |