Module: TableSchema::Constraints::Enum
- Included in:
- TableSchema::Constraints
- Defined in:
- lib/tableschema/constraints/enum.rb
Instance Method Summary collapse
Instance Method Details
#check_enum ⇒ Object
5 6 7 8 9 10 |
# 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 ⇒ Object
12 13 14 |
# File 'lib/tableschema/constraints/enum.rb', line 12 def parsed_enum @constraints[:enum].map{ |value| @field.cast_type(value) } end |