Previous topic

CSharp and OBDotNet

Next topic

Cheminformatics 101

This Page


As with the other language bindings, just follow the instructions at Compile language bindings to build the Ruby bindings.

Like any Ruby module, the Open Babel bindings can be used from a Ruby script or interactively using irb as follows:

$ irb
irb(main):001:0> require 'openbabel'
=> true
=> #<OpenBabel::OBConversion:0x2acedbadd020>
irb(main):003:0> c.set_in_format 'smi'
=> true
=> #<OpenBabel::OBMol:0x2acedbacfa10>
irb(main):005:0> c.read_string benzene, 'c1ccccc1'
=> true
irb(main):006:0> benzene.num_atoms
=> 6