Sha256: bf28e5d110ab9fc69a3c83f74b62d458f64545399ad5859c50ae9fd804841437

Contents?: true

Size: 731 Bytes

Versions: 32

Compression:

Stored size: 731 Bytes

Contents

# frozen_string_literal: true

require_relative '../../../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

32 entries across 32 versions & 1 rubygems

Version Path
puppet-8.10.0 lib/puppet/util/ldap/generator.rb
puppet-8.10.0-x86-mingw32 lib/puppet/util/ldap/generator.rb
puppet-8.10.0-x64-mingw32 lib/puppet/util/ldap/generator.rb
puppet-8.10.0-universal-darwin lib/puppet/util/ldap/generator.rb
puppet-8.9.0 lib/puppet/util/ldap/generator.rb
puppet-8.9.0-x86-mingw32 lib/puppet/util/ldap/generator.rb
puppet-8.9.0-x64-mingw32 lib/puppet/util/ldap/generator.rb
puppet-8.9.0-universal-darwin lib/puppet/util/ldap/generator.rb
puppet-8.8.1 lib/puppet/util/ldap/generator.rb
puppet-8.8.1-x86-mingw32 lib/puppet/util/ldap/generator.rb
puppet-8.8.1-x64-mingw32 lib/puppet/util/ldap/generator.rb
puppet-8.8.1-universal-darwin lib/puppet/util/ldap/generator.rb
puppet-8.7.0 lib/puppet/util/ldap/generator.rb
puppet-8.7.0-x86-mingw32 lib/puppet/util/ldap/generator.rb
puppet-8.7.0-x64-mingw32 lib/puppet/util/ldap/generator.rb
puppet-8.7.0-universal-darwin lib/puppet/util/ldap/generator.rb
puppet-8.6.0 lib/puppet/util/ldap/generator.rb
puppet-8.6.0-x86-mingw32 lib/puppet/util/ldap/generator.rb
puppet-8.6.0-x64-mingw32 lib/puppet/util/ldap/generator.rb
puppet-8.6.0-universal-darwin lib/puppet/util/ldap/generator.rb