Class: Chemicalml::Convention::Dictionary::Constraints::EntryMustHaveUnitType
- Inherits:
-
Constraint::NodeConstraint
- Object
- Constraint
- Constraint::NodeConstraint
- Chemicalml::Convention::Dictionary::Constraints::EntryMustHaveUnitType
- Defined in:
- lib/chemicalml/convention/dictionary/constraints/entry_must_have_unit_type.rb
Overview
An <entry> MUST have a unitType attribute. Entries
describing concepts that should not have units (e.g. name
of a program) should reference none in the standard CML
unitType dictionary.
Instance Method Summary collapse
Methods inherited from Constraint::NodeConstraint
Instance Method Details
#check_node(node, path) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/chemicalml/convention/dictionary/constraints/entry_must_have_unit_type.rb', line 13 def check_node(node, path) return [] unless node.unit_type.to_s.empty? [violation(path: path.join('/'), message: "entry #{node.id.inspect} must have a unitType attribute " \ "(use 'none' for concepts without units)")] end |