Method: Propertyware::WorkOrder::EnumAttributeValidator#initialize

Defined in:
lib/propertyware/models/work_order.rb

#initialize(datatype, allowable_values) ⇒ EnumAttributeValidator

Returns a new instance of EnumAttributeValidator.



128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/propertyware/models/work_order.rb', line 128

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