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.



234
235
236
237
# File 'lib/asciichem/transform.rb', line 234

def initialize(molecule, annotations)
  @molecule = molecule
  @annotations = annotations
end

Instance Method Details

#applyObject



239
240
241
# File 'lib/asciichem/transform.rb', line 239

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