Class: CC::Analyzer::MeasurementValidations::NameValidation
- Inherits:
-
Validation
- Object
- Validation
- CC::Analyzer::MeasurementValidations::NameValidation
show all
- Defined in:
- lib/cc/analyzer/measurement_validations/name_validation.rb
Constant Summary
collapse
- REGEX =
/^[A-Za-z0-9_\.\-]+$/
Instance Method Summary
collapse
Methods inherited from Validation
#initialize
Instance Method Details
#message ⇒ Object
11
12
13
|
# File 'lib/cc/analyzer/measurement_validations/name_validation.rb', line 11
def message
"Name must be present and contain only letters, numbers, periods, hyphens, and underscores"
end
|
#valid? ⇒ Boolean
7
8
9
|
# File 'lib/cc/analyzer/measurement_validations/name_validation.rb', line 7
def valid?
name&.is_a?(String) && REGEX.match?(name)
end
|