Gennady wrote: > Does anybody know an easy way to test for a class/module existence in > Ruby? What I do is adding a method to ObjectSpace for this, so that I > can test it like: > > require 'object-space' > > if ObjectSpace.contain_class?("Test::Unit::TestCase") > # do something > end Why not just if defined?(Test::Unit::TestCase) or, if you really want to check that it is a class: if defined?(Test::Unit::TestCase) && Test::Unit::TestCase.is_a?(Class)