Class: Glossarist::Validation::Rules::ConceptStatusRule
- Defined in:
- lib/glossarist/validation/rules/concept_status_rule.rb
Constant Summary collapse
- VALID_STATUSES =
Glossarist::GlossaryDefinition::CONCEPT_STATUSES
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 |
# File 'lib/glossarist/validation/rules/concept_status_rule.rb', line 14 def applicable?(context) !context.concept.status.nil? end |
#category ⇒ Object
8 |
# File 'lib/glossarist/validation/rules/concept_status_rule.rb', line 8 def category = :schema |
#check(context) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/glossarist/validation/rules/concept_status_rule.rb', line 18 def check(context) concept = context.concept fname = context.file_name status = concept.status return [] if VALID_STATUSES.include?(status) [issue( "invalid concept status '#{status}'", code: code, severity: severity, location: fname, suggestion: "Use one of: #{VALID_STATUSES.join(', ')}", )] end |
#code ⇒ Object
7 |
# File 'lib/glossarist/validation/rules/concept_status_rule.rb', line 7 def code = "GLS-201" |
#scope ⇒ Object
10 |
# File 'lib/glossarist/validation/rules/concept_status_rule.rb', line 10 def scope = :concept |
#severity ⇒ Object
9 |
# File 'lib/glossarist/validation/rules/concept_status_rule.rb', line 9 def severity = "error" |