module JsonTableSchema::Constraints::Pattern

Public Instance Methods

check_pattern() click to toggle source
# File lib/jsontableschema/constraints/pattern.rb, line 5
def check_pattern
  if !@value.to_json.match /#{@constraints['pattern']}/
    raise JsonTableSchema::ConstraintError.new("The value for the field `#{@field['name']}` must match the pattern")
  end
  true
end