Class: CDK::SmilesWriter

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

Overview

String-based SMILES writer.

Instance Method Summary collapse

Constructor Details

#initializeSmilesWriter

Returns a new instance of SmilesWriter.



132
133
134
# File 'lib/cdk/lang.rb', line 132

def initialize
  @writer = SMILESWriter.new
end

Instance Method Details

#write(mol) ⇒ Object

Returns the SMILES representation of the given molecule.

call-seq:

SmilesWriter.write(mol) => string


142
143
144
145
146
147
148
149
150
# File 'lib/cdk/lang.rb', line 142

def write mol
  string_writer = StringWriter.new

  @writer.set_writer string_writer
  @writer.write mol
  @writer.close

  string_writer.to_string.strip
end