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 12 def has_rubygems? 13 # Gems are not actually available when Bundler is loaded, even 14 # though the Gem constant is defined. This is because Bundler 15 # loads in rubygems, but then removes the custom require that 16 # rubygems installs. So when Bundler is around we have to act 17 # as though rubygems is not, e.g. we shouldn't be able to load 18 # a gem that Bundler doesn't want us to see. 19 defined? ::Gem and not defined? ::Bundler 20 end
new(*args)
click to toggle source
# File lib/puppet/util/rubygems.rb 31 def new(*args) 32 object = source.allocate 33 object.send(:initialize, *args) 34 object 35 end
source()
click to toggle source
@api private
# File lib/puppet/util/rubygems.rb 23 def source 24 if has_rubygems? 25 Gems18Source 26 else 27 NoGemsSource 28 end 29 end