module TableSchema::Constraints::MaxLength

Public Instance Methods

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