Module: Sequel::Plugins::Composition::InstanceMethods

Defined in:
lib/sequel/plugins/composition.rb

Instance Method Summary collapse

Instance Method Details

#before_validationObject

For each composition, set the columns in the model class based on the composition object.


176
177
178
179
180
# File 'lib/sequel/plugins/composition.rb', line 176

def before_validation
  # decomposer_method is private
  @compositions.keys.each{|n| send(model.compositions[n][:decomposer_method])} if @compositions
  super
end

#compositionsObject

Cache of composition objects for this class.


164
165
166
# File 'lib/sequel/plugins/composition.rb', line 164

def compositions
  @compositions ||= {}
end

#freezeObject

Freeze compositions hash when freezing model instance.


169
170
171
172
# File 'lib/sequel/plugins/composition.rb', line 169

def freeze
  compositions.freeze
  super
end