class FlattenRecord::Meta::ComputeColumn

Public Class Methods

new(parent, method, type, target_model, model, options={}) click to toggle source
Calls superclass method FlattenRecord::Meta::Column::new
# File lib/flatten_record/meta/compute_column.rb, line 4
def initialize(parent, method, type, target_model, model, options={})
  @column = Struct.
    new(:name, :default, :type, :null). 
    new(method, options[:default], type, options[:null])  
  
  super(parent, @column, target_model, model) 
end

Public Instance Methods

denormalize(instance, to_record) click to toggle source
# File lib/flatten_record/meta/compute_column.rb, line 12
def denormalize(instance, to_record)
  assign_value(to_record, name) do |record|
    record.send("compute_#{@column.name}".to_sym, instance)
  end
end