Module: Validic::Utils

Included in:
Biometrics, Diabetes, Fitness, Nutrition, Profile, Routine, Sleep, TobaccoCessation, User, Weight
Defined in:
lib/validic/utils.rb

Instance Method Summary collapse

Instance Method Details

#attributes_builder(attrs, obj) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/validic/utils.rb', line 4

def attributes_builder(attrs, obj)
  attrs.each do |k, v|
    v = Validic::Extra.new(v) if k == "extras"  && !v.nil?
    v = Validic::Profile.new(v) if k == "profile"  && !v.nil?
    instance_variable_set("@#{k}", v)
    obj.class.send(:attr_reader, k)
  end
end