class Puppet::Util::RubyGems::Source
Base/factory class for rubygems source. These classes introspec into rubygems to in order to list where the rubygems system will look for files to load.
Public Class Methods
has_rubygems?()
click to toggle source
@api private
# File lib/puppet/util/rubygems.rb 11 def has_rubygems? 12 # Gems are not actually available when Bundler is loaded, even 13 # though the Gem constant is defined. This is because Bundler 14 # loads in rubygems, but then removes the custom require that 15 # rubygems installs. So when Bundler is around we have to act 16 # as though rubygems is not, e.g. we shouldn't be able to load 17 # a gem that Bundler doesn't want us to see. 18 defined? ::Gem and not defined? ::Bundler 19 end
new(*args)
click to toggle source
# File lib/puppet/util/rubygems.rb 30 def new(*args) 31 object = source.allocate 32 object.send(:initialize, *args) 33 object 34 end
source()
click to toggle source
@api private
# File lib/puppet/util/rubygems.rb 22 def source 23 if has_rubygems? 24 Gems18Source 25 else 26 NoGemsSource 27 end 28 end