class Puppet::Util::Ldap::Generator

Public Class Methods

new(name) click to toggle source

Initialize our generator with the name of the parameter being generated.

   # File lib/puppet/util/ldap/generator.rb
22 def initialize(name)
23   @name = name
24 end

Public Instance Methods

from(source) click to toggle source

Declare the attribute we'll use to generate the value.

  # File lib/puppet/util/ldap/generator.rb
6 def from(source)
7   @source = source
8   self
9 end
generate(value = nil) click to toggle source

Actually do the generation.

   # File lib/puppet/util/ldap/generator.rb
12 def generate(value = nil)
13   if value.nil?
14     @generator.call
15   else
16     @generator.call(value)
17   end
18 end
name() click to toggle source
   # File lib/puppet/util/ldap/generator.rb
26 def name
27   @name.to_s
28 end
source() click to toggle source
   # File lib/puppet/util/ldap/generator.rb
30 def source
31   if @source
32     @source.to_s
33   else
34     nil
35   end
36 end
with(&block) click to toggle source

Provide the code that does the generation.

   # File lib/puppet/util/ldap/generator.rb
39 def with(&block)
40   @generator = block
41   self
42 end