Class: Dcc::Validate::Schematron::Rules::NonSiDeclaration
- Inherits:
-
Base
- Object
- Dcc::Validate::Schematron::Rule
- Base
- Dcc::Validate::Schematron::Rules::NonSiDeclaration
- Defined in:
- lib/dcc/validate/schematron/rules/non_si_declaration.rb
Overview
Validates that non-SI units (prefixed with |) are declared
somewhere in the DCC via dcc:nonSIUnit and dcc:nonSIDefinition
elements inside dcc:statement.
Instance Method Summary collapse
Methods inherited from Dcc::Validate::Schematron::Rule
Instance Method Details
#check_on(dcc) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/dcc/validate/schematron/rules/non_si_declaration.rb', line 11 def check_on(dcc) issues = [] return issues unless dcc.is_a?(::Lutaml::Model::Serializable) declared_units = collect_declared_non_si_units(dcc, ::Set.new) used_units = ::Set.new walk_for_used_units(dcc, used_units, ::Set.new) (used_units - declared_units).each do |unit| issues << issue( severity: :error, message: "non-SI unit '#{unit}' is used but not declared in dcc:nonSIUnit", ) end issues end |