module TableSchema::Constraints::MinLength

Public Instance Methods

check_min_length() click to toggle source
# File lib/tableschema/constraints/min_length.rb, line 5
def check_min_length
  return if @value.nil?
  if @value.length < parsed_min_length
    raise TableSchema::ConstraintError.new("The field `#{@field[:name]}` must have a minimum length of #{@constraints[:minLength]}")
  end
  true
end
parsed_min_length() click to toggle source
# File lib/tableschema/constraints/min_length.rb, line 13
def parsed_min_length
  @constraints[:minLength].to_i
end