Method: FormAPI::Template::EnumAttributeValidator#initialize

Defined in:
lib/form_api/models/template.rb

#initialize(datatype, allowable_values) ⇒ EnumAttributeValidator

Returns a new instance of EnumAttributeValidator.



57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/form_api/models/template.rb', line 57

def initialize(datatype, allowable_values)
  @allowable_values = allowable_values.map do |value|
    case datatype.to_s
    when /Integer/i
      value.to_i
    when /Float/i
      value.to_f
    else
      value
    end
  end
end