Class: CDK::SmilesWriter
- Inherits:
-
Object
- Object
- CDK::SmilesWriter
- Defined in:
- lib/cdk/lang.rb
Overview
String-based SMILES writer.
Instance Method Summary collapse
-
#initialize ⇒ SmilesWriter
constructor
A new instance of SmilesWriter.
-
#write(mol) ⇒ Object
Returns the SMILES representation of the given molecule.
Constructor Details
#initialize ⇒ SmilesWriter
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 |