# 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, line 21
    def initialize(name)
      @name = name
    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, line 5
    def from(source)
      @source = source
      self
    end

generate(value = nil) click to toggle source

Actually do the generation.

    # File lib/puppet/util/ldap/generator.rb, line 11
    def generate(value = nil)
      if value.nil?
        @generator.call
      else
        @generator.call(value)
      end
    end

name() click to toggle source

    # File lib/puppet/util/ldap/generator.rb, line 25
    def name
      @name.to_s
    end

source() click to toggle source

    # File lib/puppet/util/ldap/generator.rb, line 29
    def source
      if @source
        @source.to_s
      else
        nil
      end
    end

with(&block) click to toggle source

Provide the code that does the generation.

    # File lib/puppet/util/ldap/generator.rb, line 38
    def with(&block)
      @generator = block
      self
    end