module Sequel::Plugins::Composition::InstanceMethods
Public Instance Methods
compositions()
click to toggle source
Cache of composition objects for this class.
# File lib/sequel/plugins/composition.rb, line 153 def compositions @compositions ||= {} end
freeze()
click to toggle source
Freeze compositions hash when freezing model instance.
Calls superclass method
# File lib/sequel/plugins/composition.rb, line 158 def freeze compositions.freeze super end
Private Instance Methods
_before_validation()
click to toggle source
For each composition, set the columns in the model class based on the composition object.
Calls superclass method
# File lib/sequel/plugins/composition.rb, line 167 def _before_validation @compositions.keys.each{|n| instance_eval(&model.compositions[n][:decomposer])} if @compositions super end
_refresh_set_values(hash)
click to toggle source
Clear the cached compositions when manually refreshing.
Calls superclass method
# File lib/sequel/plugins/composition.rb, line 173 def _refresh_set_values(hash) @compositions.clear if @compositions super end
initialize_copy(other)
click to toggle source
Duplicate compositions hash when duplicating model instance.
Calls superclass method
# File lib/sequel/plugins/composition.rb, line 179 def initialize_copy(other) super @compositions = other.compositions.dup self end