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.


181
182
183
184
185
# File 'lib/sequel/plugins/composition.rb', line 181

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.


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

def compositions
  @compositions ||= {}
end

#freezeObject

Freeze compositions hash when freezing model instance.


173
174
175
176
177
# File 'lib/sequel/plugins/composition.rb', line 173

def freeze
  compositions
  super
  compositions.freeze
end