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 156 |
# File 'lib/sequel/plugins/composition.rb', line 152 def _refresh(ds) v = super compositions.clear v end |
#before_save ⇒ Object
For each composition, set the columns in the model class based on the composition object.
160 161 162 163 |
# File 'lib/sequel/plugins/composition.rb', line 160 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.
166 167 168 |
# File 'lib/sequel/plugins/composition.rb', line 166 def compositions @compositions ||= {} end |