Class: AsciiChem::Transform::AnnotationApplicator

Inherits:
Object
  • Object
show all
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

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

#applyObject



172
173
174
# File 'lib/asciichem/transform.rb', line 172

def apply
  @annotations.each { |ann| apply_one(ann) }
end