module JsonTableSchema::Constraints::MaxLength

Public Instance Methods

check_max_length() click to toggle source
# File lib/jsontableschema/constraints/max_length.rb, line 5
def check_max_length
  return if @value.nil?
  if @value.length > @constraints['maxLength'].to_i
    raise JsonTableSchema::ConstraintError.new("The field `#{@field['name']}` must have a maximum length of #{@constraints['maxLength']}")
  end
  true
end