Class: Chemicalml::Convention::SimpleUnit::Constraints::UnitMustHavePower
- Inherits:
-
Constraint::NodeConstraint
- Object
- Constraint
- Constraint::NodeConstraint
- Chemicalml::Convention::SimpleUnit::Constraints::UnitMustHavePower
- Defined in:
- lib/chemicalml/convention/simple_unit/constraints/unit_must_have_power.rb
Overview
A <unit> under simpleUnit MUST declare a power attribute
(integer). Without a power the unit's exponent is undefined.
Instance Method Summary collapse
Methods inherited from Constraint::NodeConstraint
Instance Method Details
#check_node(node, _path) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/chemicalml/convention/simple_unit/constraints/unit_must_have_power.rb', line 13 def check_node(node, _path) power = node.power.to_s.strip return [] unless power.empty? [violation(path: yield_path(node), message: "unit #{node.id.inspect} must declare a power attribute", value: node.power)] end |