Class: Chemicalml::Convention::Molecular::Constraints::BondOrderShouldNotBeNumeric
- Inherits:
-
Constraint::NodeConstraint
- Object
- Constraint
- Constraint::NodeConstraint
- Chemicalml::Convention::Molecular::Constraints::BondOrderShouldNotBeNumeric
- Defined in:
- lib/chemicalml/convention/molecular/constraints/bond_order_should_not_be_numeric.rb
Constant Summary collapse
- VALID_ORDERS =
%w[S D T Q A other].freeze
Instance Method Summary collapse
Methods inherited from Constraint::NodeConstraint
Instance Method Details
#check_node(node, path) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/chemicalml/convention/molecular/constraints/bond_order_should_not_be_numeric.rb', line 10 def check_node(node, path) return [] unless node.is_a?(Chemicalml::Cml::Role::Bond) order = node.order.to_s return [] if order.empty? return [] if VALID_ORDERS.include?(order) || node.dict_ref.to_s.size.positive? [violation(path: path.empty? ? "bond" : path.join("/"), message: "bond order #{order.inspect} is not recommended " \ "(use S/D/T/Q/A or 'other' with dictRef)", severity: :warning)] end |