Class: Glossarist::Validation::Rules::UuidFormatRule
- Defined in:
- lib/glossarist/validation/rules/uuid_format_rule.rb
Constant Summary collapse
- UUID_RE =
/\A[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\z/i.freeze
Instance Method Summary collapse
Methods inherited from Base
Instance Method Details
#category ⇒ Object
10 |
# File 'lib/glossarist/validation/rules/uuid_format_rule.rb', line 10 def category = :integrity |
#check(context) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/glossarist/validation/rules/uuid_format_rule.rb', line 14 def check(context) concept = context.concept fname = context.file_name issues = [] uuid = concept.uuid if uuid && !uuid.to_s.empty? && !UUID_RE.match?(uuid.to_s) issues << issue( "concept UUID '#{uuid}' is not valid UUID format", location: fname, suggestion: "Use a valid UUID (e.g. 0ce27901-02ce-531e-8ba5-fdb136139d1a)", ) end issues end |
#code ⇒ Object
9 |
# File 'lib/glossarist/validation/rules/uuid_format_rule.rb', line 9 def code = "GLS-016" |
#scope ⇒ Object
12 |
# File 'lib/glossarist/validation/rules/uuid_format_rule.rb', line 12 def scope = :concept |
#severity ⇒ Object
11 |
# File 'lib/glossarist/validation/rules/uuid_format_rule.rb', line 11 def severity = "error" |