Class: CDK::MolfileWriter

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

Overview

String-based molfile writer.

Instance Method Summary collapse

Constructor Details

#initializeMolfileWriter



86
87
88
# File 'lib/cdk/lang.rb', line 86

def initialize
  @writer = MDLWriter.new
end

Instance Method Details

#write(mol) ⇒ Object

Returns the molfile representation of the given molecule.

call-seq:

MolfileWriter.write(mol) => string


95
96
97
98
99
100
101
102
103
# File 'lib/cdk/lang.rb', line 95

def write mol
  string_writer = StringWriter.new

  @writer.set_writer string_writer
  @writer.write_molecule mol
  @writer.close

  string_writer.to_string
end