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 21 def initialize(name) 22 @name = name 23 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 5 def from(source) 6 @source = source 7 self 8 end
generate(value = nil)
click to toggle source
Actually do the generation.
# File lib/puppet/util/ldap/generator.rb 11 def generate(value = nil) 12 if value.nil? 13 @generator.call 14 else 15 @generator.call(value) 16 end 17 end
name()
click to toggle source
# File lib/puppet/util/ldap/generator.rb 25 def name 26 @name.to_s 27 end
source()
click to toggle source
# File lib/puppet/util/ldap/generator.rb 29 def source 30 if @source 31 @source.to_s 32 else 33 nil 34 end 35 end
with(&block)
click to toggle source
Provide the code that does the generation.
# File lib/puppet/util/ldap/generator.rb 38 def with(&block) 39 @generator = block 40 self 41 end