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