Module: TableSchema::Constraints::MaxLength
- Included in:
- TableSchema::Constraints
- Defined in:
- lib/tableschema/constraints/max_length.rb
Instance Method Summary collapse
Instance Method Details
#check_max_length ⇒ Object
5 6 7 8 9 10 11 |
# 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 ⇒ Object
13 14 15 |
# File 'lib/tableschema/constraints/max_length.rb', line 13 def parsed_max_length @constraints[:maxLength].to_i end |