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