Sha256: 2da61989b0d8d33422bd651b2a293521c980acf0b45d2be31a6e79f28f70e4a0

Contents?: true

Size: 768 Bytes

Versions: 21

Compression:

Stored size: 768 Bytes

Contents

#
#  Created by Luke Kanies on 2008-3-28.
#  Copyright (c) 2008. All rights reserved.
require 'puppet/util/ldap'

class Puppet::Util::Ldap::Generator
  # Declare the attribute we'll use to generate the value.
  def from(source)
    @source = source
    self
  end

  # Actually do the generation.
  def generate(value = nil)
    if value.nil?
      @generator.call
    else
      @generator.call(value)
    end
  end

  # Initialize our generator with the name of the parameter
  # being generated.
  def initialize(name)
    @name = name
  end

  def name
    @name.to_s
  end

  def source
    if @source
      @source.to_s
    else
      nil
    end
  end

  # Provide the code that does the generation.
  def with(&block)
    @generator = block
    self
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
puppet-2.6.18 lib/puppet/util/ldap/generator.rb
puppet-2.6.17 lib/puppet/util/ldap/generator.rb
puppet-2.6.16 lib/puppet/util/ldap/generator.rb
puppet-2.6.15 lib/puppet/util/ldap/generator.rb
puppet-2.6.14 lib/puppet/util/ldap/generator.rb
puppet-2.6.13 lib/puppet/util/ldap/generator.rb
puppet-2.6.12 lib/puppet/util/ldap/generator.rb
puppet-2.6.11 lib/puppet/util/ldap/generator.rb
puppet-2.6.10 lib/puppet/util/ldap/generator.rb
puppet-2.7.3 lib/puppet/util/ldap/generator.rb
puppet-2.7.1 lib/puppet/util/ldap/generator.rb
puppet-2.6.9 lib/puppet/util/ldap/generator.rb
puppet-2.6.8 lib/puppet/util/ldap/generator.rb
puppet-2.6.7 lib/puppet/util/ldap/generator.rb
puppet-2.6.6 lib/puppet/util/ldap/generator.rb
puppet-2.6.5 lib/puppet/util/ldap/generator.rb
puppet-2.6.4 lib/puppet/util/ldap/generator.rb
puppet-2.6.3 lib/puppet/util/ldap/generator.rb
puppet-2.6.2 lib/puppet/util/ldap/generator.rb
puppet-2.6.1 lib/puppet/util/ldap/generator.rb