Class: CDK::InChIWriter

Inherits:
Object
  • Object
show all
Defined in:
lib/cdk/lang.rb

Overview

String-based InChI writer.

Instance Method Summary collapse

Constructor Details

#initializeInChIWriter

Returns a new instance of InChIWriter.



111
112
113
114
# File 'lib/cdk/lang.rb', line 111

def initialize
  @factory = InChIGeneratorFactory.new
  @hydrogen_adder = HydrogenAdder.new
end

Instance Method Details

#write(mol) ⇒ Object

Returns the InChI representation of the given molecule.

call-seq:

InChIWriter.write(mol) => string


121
122
123
124
# File 'lib/cdk/lang.rb', line 121

def write mol
  @hydrogen_adder.add_implicit_hydrogens_to_satisfy_valency mol
  @factory.getInChIGenerator(mol).inchi
end