module Sequel::Plugins::Composition::InstanceMethods

Public 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
176 def before_validation
177   # decomposer_method is private
178   @compositions.keys.each{|n| send(model.compositions[n][:decomposer_method])} if @compositions
179   super
180 end
compositions() click to toggle source

Cache of composition objects for this class.

    # File lib/sequel/plugins/composition.rb
164 def compositions
165   @compositions ||= {}
166 end
freeze() click to toggle source

Freeze compositions hash when freezing model instance.

Calls superclass method
    # File lib/sequel/plugins/composition.rb
169 def freeze
170   compositions.freeze
171   super
172 end

Private Instance Methods

_refresh_set_values(hash) click to toggle source

Clear the cached compositions when manually refreshing.

Calls superclass method
    # File lib/sequel/plugins/composition.rb
185 def _refresh_set_values(hash)
186   @compositions.clear if @compositions
187   super
188 end
initialize_copy(other) click to toggle source

Duplicate compositions hash when duplicating model instance.

Calls superclass method
    # File lib/sequel/plugins/composition.rb
191 def initialize_copy(other)
192   super
193   @compositions = Hash[other.compositions]
194   self
195 end