Class: Glossarist::Validation::Rules::ConceptCountRule

Inherits:
Base
  • Object
show all
Defined in:
lib/glossarist/validation/rules/concept_count_rule.rb

Instance Method Summary collapse

Methods inherited from Base

inherited

Instance Method Details

#applicable?(context) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/glossarist/validation/rules/concept_count_rule.rb', line 12

def applicable?(context)
  context. && context..concept_count
end

#categoryObject



8
# File 'lib/glossarist/validation/rules/concept_count_rule.rb', line 8

def category = :integrity

#check(context) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/glossarist/validation/rules/concept_count_rule.rb', line 16

def check(context)
  expected = context..concept_count
  actual = context.concepts.size

  return [] if expected == actual

  [issue(
    "metadata.yaml concept_count is #{expected} " \
    "but found #{actual} concept files",
    code: code, severity: severity,
    location: "metadata.yaml",
    suggestion: "Update concept_count or add/remove concept files",
  )]
end

#codeObject



7
# File 'lib/glossarist/validation/rules/concept_count_rule.rb', line 7

def code = "GLS-011"

#scopeObject



10
# File 'lib/glossarist/validation/rules/concept_count_rule.rb', line 10

def scope = :collection

#severityObject



9
# File 'lib/glossarist/validation/rules/concept_count_rule.rb', line 9

def severity = "error"