Class: Chemicalml::Convention::Spectroscopy::Constraints::PeakShouldHaveValues
- Inherits:
-
Constraint::NodeConstraint
- Object
- Constraint
- Constraint::NodeConstraint
- Chemicalml::Convention::Spectroscopy::Constraints::PeakShouldHaveValues
- Defined in:
- lib/chemicalml/convention/spectroscopy/constraints/peak_should_have_values.rb
Overview
A <peak> SHOULD declare at least one of xValue or
yValue. A peak with neither carries no position
information. Warning severity — there are edge cases
(e.g. group-references) where this is intentional.
Instance Method Summary collapse
Methods inherited from Constraint::NodeConstraint
Instance Method Details
#check_node(node, _path) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/chemicalml/convention/spectroscopy/constraints/peak_should_have_values.rb', line 15 def check_node(node, _path) return [] unless node.xValue.to_s.empty? && node.yValue.to_s.empty? [violation(path: yield_path(node), message: "peak #{node.id.inspect} should have at least one of xValue or yValue", severity: :warning, value: { xValue: node.xValue, yValue: node.yValue }.freeze)] end |