module TableSchema::Constraints::Minimum
Public Instance Methods
check_minimum()
click to toggle source
# File lib/tableschema/constraints/minimum.rb, line 5 def check_minimum if @field.type == 'yearmonth' valid = Date.new(@value[:year], @value[:month]) >= Date.new(parsed_minimum[:year], parsed_minimum[:month]) else valid = @value >= parsed_minimum end unless valid raise TableSchema::ConstraintError.new("The field `#{@field[:name]}` must not be less than #{@constraints[:minimum]}") end true end
parsed_minimum()
click to toggle source
# File lib/tableschema/constraints/minimum.rb, line 18 def parsed_minimum @field.cast_type(@constraints[:minimum]) end