module DCA::Models::Binder

Constants

COMPLEX_TYPE

Public Instance Methods

bind(content) click to toggle source
# File lib/dca/models/binder.rb, line 47
def bind content
  self.class.associations.each do |field, options|
    update field, self.class.binder.parse(self, content, options), options[:options][:append]
  end
  self
end

Private Instance Methods

update(field, value, append = false) click to toggle source
# File lib/dca/models/binder.rb, line 56
def update field, value, append = false
  if append
    new_value = self.instance_variable_get("@#{field.to_s}")
    new_value  = new_value ? new_value + value : value
    self.instance_variable_set "@#{field.to_s}", new_value
  else
    self.instance_variable_set "@#{field.to_s}", value
  end
end