Class: Glossarist::Validation::Rules::DateValidityRule
- Defined in:
- lib/glossarist/validation/rules/date_validity_rule.rb
Instance Method Summary collapse
- #applicable?(context) ⇒ Boolean
- #category ⇒ Object
- #check(context) ⇒ Object
- #code ⇒ Object
- #scope ⇒ Object
- #severity ⇒ Object
Methods inherited from Base
Instance Method Details
#applicable?(context) ⇒ Boolean
14 15 16 17 |
# File 'lib/glossarist/validation/rules/date_validity_rule.rb', line 14 def applicable?(context) concept = context.concept (concept.dates&.any?) || concept.date_accepted end |
#category ⇒ Object
10 |
# File 'lib/glossarist/validation/rules/date_validity_rule.rb', line 10 def category = :quality |
#check(context) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/glossarist/validation/rules/date_validity_rule.rb', line 19 def check(context) concept = context.concept fname = context.file_name issues = [] (concept.dates || []).each_with_index do |date, idx| validate_date(date, "date #{idx + 1}", fname, issues) end if concept.date_accepted validate_date(concept.date_accepted, "date_accepted", fname, issues) end issues end |
#code ⇒ Object
9 |
# File 'lib/glossarist/validation/rules/date_validity_rule.rb', line 9 def code = "GLS-307" |
#scope ⇒ Object
12 |
# File 'lib/glossarist/validation/rules/date_validity_rule.rb', line 12 def scope = :concept |
#severity ⇒ Object
11 |
# File 'lib/glossarist/validation/rules/date_validity_rule.rb', line 11 def severity = "warning" |