Class: AsciiChem::Transform::AnnotationApplicator
- Inherits:
-
Object
- Object
- AsciiChem::Transform::AnnotationApplicator
- Defined in:
- lib/asciichem/transform.rb
Overview
Applies @key("value") molecule annotations to a built
Model::Molecule. The annotation type determines which field is
set: name → names, inchi/smiles/cas → identifiers, etc.
Constant Summary collapse
- IDENTIFIER_TYPES =
%w[inchi smiles cas iupac cid chebi].freeze
Instance Method Summary collapse
- #apply ⇒ Object
-
#initialize(molecule, annotations) ⇒ AnnotationApplicator
constructor
A new instance of AnnotationApplicator.
Constructor Details
#initialize(molecule, annotations) ⇒ AnnotationApplicator
Returns a new instance of AnnotationApplicator.
167 168 169 170 |
# File 'lib/asciichem/transform.rb', line 167 def initialize(molecule, annotations) @molecule = molecule @annotations = annotations end |
Instance Method Details
#apply ⇒ Object
172 173 174 |
# File 'lib/asciichem/transform.rb', line 172 def apply @annotations.each { |ann| apply_one(ann) } end |