Class: Glossarist::Validation::Rules::DateTypeRule

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

Constant Summary collapse

VALID_TYPES =
Glossarist::GlossaryDefinition::CONCEPT_DATE_TYPES

Instance Method Summary collapse

Methods inherited from Base

inherited

Instance Method Details

#applicable?(context) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
# File 'lib/glossarist/validation/rules/date_type_rule.rb', line 14

def applicable?(context)
  concept = context.concept
  (concept.dates&.any?) || concept.date_accepted
end

#categoryObject



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

def category = :schema

#check(context) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/glossarist/validation/rules/date_type_rule.rb', line 19

def check(context)
  concept = context.concept
  fname = context.file_name
  issues = []

  check_date_collection(concept.dates, fname, issues)

  if concept.date_accepted && concept.date_accepted.type
    validate_date_type(concept.date_accepted, "date_accepted", fname, issues)
  end

  issues
end

#codeObject



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

def code = "GLS-205"

#scopeObject



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

def scope = :concept

#severityObject



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

def severity = "warning"