Class: FormatValidation
- Inherits:
-
Validation
show all
- Defined in:
- lib/yodel/models/core/validations/format_validation.rb
Instance Attribute Summary
Attributes inherited from Validation
#field, #params
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Validation
#initialize, #to_json
Constructor Details
This class inherits a constructor from Validation
Class Method Details
.validate(params, field, name, value, record, errors) ⇒ Object
2
3
4
5
|
# File 'lib/yodel/models/core/validations/format_validation.rb', line 2
def self.validate(params, field, name, value, record, errors)
format = params['format']
errors[field.name] << new(format) unless value =~ Regexp.new(format)
end
|
Instance Method Details
#describe ⇒ Object
7
8
9
|
# File 'lib/yodel/models/core/validations/format_validation.rb', line 7
def describe
"is not in the required format"
end
|