Module: JsonTableSchema::Constraints::Pattern

Included in:
JsonTableSchema::Constraints
Defined in:
lib/jsontableschema/constraints/pattern.rb

Instance Method Summary collapse

Instance Method Details

#check_patternObject



5
6
7
8
9
10
# 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