Method: Connect::Dsl#datasource
- Defined in:
- lib/connect/dsl.rb
#datasource(name, *parameters) ⇒ Object
create a datasource with the specfied name. A datasource object will be created who’s type is Connect::Datasources::name. The Puppet autoloader will try to locate this object in any of the loaded gems and modules.
When it is found, it is initialized whit the name and the passed parameters
213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/connect/dsl.rb', line 213 def datasource(name, *parameters) name = interpolated_value(name) Connect.debug "Loading datasource #{name}" source_name = name.to_s.split('_').collect(&:capitalize).join # Camelize klass_name = "Connect::Datasources::#{source_name}" klass = Puppet::Pops::Types::ClassLoader.provide_from_string(klass_name) if klass @current_importer = klass.new(name, *parameters) else fail ArgumentError, "specfied importer '#{name}' doesn't exist" end end |