Check for Ruby Gem availability

In Ruby 1.9.3 only there is also:

Gem.available?('somegem')

You can use regex expressions too. Handy if I want to allow ‘rcov’ and GitHub variants like ‘relevance-rcov’:

Gem.available?(/-?rcov$/)

Leave a Comment