class Object
Public Instance Methods
require_gem(gem_name)
click to toggle source
Very handy (that’s why it’s in global scope) Raises an exception unless the given gem is installed Requires the gem if it is installed
# File lib/reviser.rb, line 50 def require_gem gem_name unless Gem::Specification::find_all_by_name(gem_name).any? raise Gem::LoadError, "#{gem_name}".yellow + " => ".white + "gem install #{gem_name}".magenta end require gem_name end