[Rubygems-developers] Getting the gem spec

Daniel Berger djberg96 at gmail.com
Thu Dec 3 03:25:01 EST 2009


I'm trying to get the spec of a gem by name and version. I noticed you 
could do this:

spec = Gem::GemPathSearcher.new.find('my_gem')

But GemPathSearcher doesn't appear to allow a version.

I saw this bit in check_command.rb:

dependency = Gem::Dependency.new('my_gem', some_version)
spec = Gem::SourceIndex.from_installed_gems.search(dependency).first

But it felt a bit clunky.

Is there a simpler way?



More information about the Rubygems-developers mailing list