Method: Va::Model#initialize

Defined in:
lib/va.rb

#initialize(args = {}) ⇒ Model

Returns a new instance of Model.



8
9
10
11
12
13
14
15
16
# File 'lib/va.rb', line 8

def initialize(args={})
  @attributes ||= self.class.defaults.dup
  args.each do |k, v|
    key = k.to_sym
    @attributes[key] = v if self.class.keys.include?(key)
  end
  @errors = {}
  @valid = validate
end