Class: Chemicalml::Convention::Molecular::Constraints::MoleculeCountMustNotAppearOnTopLevel
- Inherits:
-
Constraint::DocumentConstraint
- Object
- Constraint
- Constraint::DocumentConstraint
- Chemicalml::Convention::Molecular::Constraints::MoleculeCountMustNotAppearOnTopLevel
- Defined in:
- lib/chemicalml/convention/molecular/constraints/molecule_count_must_not_appear_on_top_level.rb
Overview
Molecular convention: count MUST NOT appear on top-level
molecules (direct children of <cml>). It is REQUIRED on
molecules nested inside another <molecule>.
Instance Method Summary collapse
Instance Method Details
#check(document) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/chemicalml/convention/molecular/constraints/molecule_count_must_not_appear_on_top_level.rb', line 11 def check(document) violations = [] top_level_molecules(document).each do |mol, path| next if mol.count.to_s.empty? violations << violation( path: (path + [describe(mol)]).join('/'), message: "top-level molecule #{mol.id.inspect} must not have " \ 'a count attribute (only nested molecules may carry count)' ) end violations end |