Class: Puppet::Pops::Binder::BindingsLoader
- Defined in:
- lib/puppet/pops/binder/bindings_loader.rb
Overview
The ClassLoader provides a Class instance given a class name or a meta-type. If the class is not already loaded, it is loaded using the Puppet Autoloader. This means it can load a class from a gem, or from puppet modules.
Class Method Summary collapse
-
.loadable?(basedir, name) ⇒ String?
If loadable name exists relative to a a basedir or not.
-
.provide(scope, name) ⇒ Class?
Returns a XXXXX given a fully qualified class name.
Class Method Details
.loadable?(basedir, name) ⇒ String?
If loadable name exists relative to a a basedir or not. Returns the loadable path as a side effect.
35 36 37 38 39 |
# File 'lib/puppet/pops/binder/bindings_loader.rb', line 35 def self.loadable?(basedir, name) # note, "lib" is added by the autoloader # paths_for_name(name).find {|p| Puppet::FileSystem.exist?(File.join(basedir, "lib/puppet/bindings", p)+'.rb') } end |
.provide(scope, name) ⇒ Class?
Returns a XXXXX given a fully qualified class name. Lookup of class is never relative to the calling namespace.
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/puppet/pops/binder/bindings_loader.rb', line 19 def self.provide(scope, name) case name when String provide_from_string(scope, name) when Array provide_from_name_path(scope, name.join('::'), name) else raise ArgumentError, "Cannot provide a bindings from a '#{name.class.name}'" end end |