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
184 def before_validation
185   # decomposer_method is private
186   @compositions.keys.each{|n| send(model.compositions[n][:decomposer_method])} if @compositions
187   super
188 end
compositions() click to toggle source

Cache of composition objects for this class.

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

Freeze compositions hash when freezing model instance.

Calls superclass method
    # File lib/sequel/plugins/composition.rb
175 def freeze
176   compositions
177   super
178   compositions.freeze
179   self
180 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
193 def _refresh_set_values(hash)
194   @compositions.clear if @compositions
195   super
196 end
initialize_copy(other) click to toggle source

Duplicate compositions hash when duplicating model instance.

Calls superclass method
    # File lib/sequel/plugins/composition.rb
199 def initialize_copy(other)
200   super
201   @compositions = Hash[other.compositions]
202   self
203 end