Class: Puppet::Util::Ldap::Generator
- Defined in:
- lib/puppet/util/ldap/generator.rb
Instance Method Summary collapse
-
#from(source) ⇒ Object
Declare the attribute we’ll use to generate the value.
-
#generate(value = nil) ⇒ Object
Actually do the generation.
-
#initialize(name) ⇒ Generator
constructor
Initialize our generator with the name of the parameter being generated.
- #name ⇒ Object
- #source ⇒ Object
-
#with(&block) ⇒ Object
Provide the code that does the generation.
Constructor Details
#initialize(name) ⇒ Generator
Initialize our generator with the name of the parameter being generated.
24 25 26 |
# File 'lib/puppet/util/ldap/generator.rb', line 24 def initialize(name) @name = name end |
Instance Method Details
#from(source) ⇒ Object
Declare the attribute we’ll use to generate the value.
8 9 10 11 |
# File 'lib/puppet/util/ldap/generator.rb', line 8 def from(source) @source = source self end |
#generate(value = nil) ⇒ Object
Actually do the generation.
14 15 16 17 18 19 20 |
# File 'lib/puppet/util/ldap/generator.rb', line 14 def generate(value = nil) if value.nil? @generator.call else @generator.call(value) end end |
#name ⇒ Object
28 29 30 |
# File 'lib/puppet/util/ldap/generator.rb', line 28 def name @name.to_s end |
#source ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/puppet/util/ldap/generator.rb', line 32 def source if @source @source.to_s else nil end end |
#with(&block) ⇒ Object
Provide the code that does the generation.
41 42 43 44 |
# File 'lib/puppet/util/ldap/generator.rb', line 41 def with(&block) @generator = block self end |