From: Lars Haugseth Date: 2012-10-04T19:22:31+09:00 Subject: Re: How to get installed module version On 10/04/2012 12:03 PM, Abhishek K. wrote: > "Jes炭s Gabriel y Gal叩n" wrote in post >>> >>> I am new to ruby, just need one liner command in ruby to check any >>> installed version. like in perl we do >>> >>> perl -MABC -e 'print "$ABC::VERSION"' >> >> $ gem list nokogiri >> >> *** LOCAL GEMS *** >> >> nokogiri (1.5.5, 1.5.0) > > Thanks Jesus, is there any way i can get by ruby command like > > ruby1.8 -rMODULE -e 'puts ....' > ruby1.9.1 -rMODULE -e 'puts ....' If you want to search for more information on this topic, note that the correct term for "modules" in the Ruby world is "gems". You can get at information about installed gems from Ruby code through the Gem::Specification class. http://rubygems.rubyforge.org/rubygems-update/Gem/Specification.html What are you going to do with that information, though? If your code depends on certain versions of gems, you should take a look at Bundler. http://gembundler.com/ -- Lars Haugseth