# File lib/enumerated_attribute/integrations/object.rb, line 9 def write_enumerated_attribute(name, val) name = name.to_s val = nil if val == '' val = val.to_sym if val unless self.class.enumerated_attribute_allows_value?(name, val) raise(InvalidEnumeration, "nil is not allowed on '#{name}' attribute, set :nil=>true option", caller) unless val raise(InvalidEnumeration, ":#{val} is not a defined enumeration value for the '#{name}' attribute", caller) end instance_variable_set('@'+name, val) end