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
173 def before_validation
174   @compositions.keys.each{|n| instance_exec(&model.compositions[n][:decomposer])} if @compositions
175   super
176 end
compositions() click to toggle source

Cache of composition objects for this class.

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

Freeze compositions hash when freezing model instance.

Calls superclass method
    # File lib/sequel/plugins/composition.rb
166 def freeze
167   compositions.freeze
168   super
169 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
181 def _refresh_set_values(hash)
182   @compositions.clear if @compositions
183   super
184 end
initialize_copy(other) click to toggle source

Duplicate compositions hash when duplicating model instance.

Calls superclass method
    # File lib/sequel/plugins/composition.rb
187 def initialize_copy(other)
188   super
189   @compositions = Hash[other.compositions]
190   self
191 end