Lars Haugseth wrote in post #1078619:
> On 10/04/2012 12:32 PM, Abhishek K. wrote:
>> i am looking something we do in perl and python same way in ruby like
>>
>> perl -MABC -e 'print "$ABC::VERSION"'
>>
>> python -c "import MODULE; print (MODULE.__version__)";
>
> List all gems and their version:
>
> $ ruby -e 'puts Gem::Specification.map {|gem| "#{gem.name}:
> #{gem.version}"}'
>
> List all installed versions of a particular gem:
>
> $ ruby -e 'puts
> Gem::Specification.find_all_by_name("rake").map(&:version)'

Thanks Lars.

This is not giving all but only inside Gems dir

-- 
Posted via http://www.ruby-forum.com/.