module TableSchema::Constraints::Enum

Public Instance Methods

check_enum() click to toggle source
# File lib/tableschema/constraints/enum.rb, line 5
def check_enum
  unless parsed_enum.include?(@value)
    raise TableSchema::ConstraintError.new("The value for the field `#{@field[:name]}` must be in the enum array")
  end
  true
end
parsed_enum() click to toggle source
# File lib/tableschema/constraints/enum.rb, line 12
def parsed_enum
  @constraints[:enum].map{ |value| @field.cast_type(value) }
end