lib/csv2hash/validator.rb in csv2hash-0.1 vs lib/csv2hash/validator.rb in csv2hash-0.1.1
- old
+ new
@@ -23,10 +23,14 @@
raise unless value unless rule.fetch :allow_blank
if (extra_validator = rule.fetch :extra_validator) && extra_validator.kind_of?(Csv2hash::ExtraValidator)
raise unless extra_validator.valid? rule, value
else
if value && (values = rule.fetch :values)
- raise unless values.include?(value)
+ if values.class == Range
+ raise unless values.include?(value.to_f)
+ else
+ raise unless values.include?(value)
+ end
end
end
rescue => e
raise message(rule, y, x)
end