tags:

views:

27

answers:

1

Is there a way to require a gem and then get the version number of that gem from within ruby?

+1  A: 

You could try

Gem.loaded_specs[$NAME_OF_GEM].version
pgmura
In general: RubyGems is actually a Ruby library. The `gem` commandline program is actually just a very thin wrapper around that library. Everything you can do with the `gem` command (and more), you can also do with the RubyGems library. The only problem is documentation, although the code itself is well tested and largely well written and can thus sometimes serve as a substitue for documentation.
Jörg W Mittag