Sha256: b087da8c19e662bc644198f2a152da1212574d9a0c73d02f2b164767f550ab3d

Contents?: true

Size: 1.3 KB

Versions: 20

Compression:

Stored size: 1.3 KB

Contents

# frozen_string_literal: true
Puppet::Type.newtype(:whit) do
  desc "Whits are internal artifacts of Puppet's current implementation, and
    Puppet suppresses their appearance in all logs. We make no guarantee of
    the whit's continued existence, and it should never be used in an actual
    manifest. Use the `anchor` type from the puppetlabs-stdlib module if you
    need arbitrary whit-like no-op resources."

  newparam :name do
    desc "The name of the whit, because it must have one."
  end


  # Hide the fact that we're a whit from logs.
  #
  # I hate you, milkman whit.  You are so painful, so often.
  #
  # In this case the memoized version means we generate a new string about 1.9
  # percent of the time, and we allocate about 1.6MB less memory, and generate
  # a whole lot less GC churn.
  #
  # That number probably goes up at least O(n) with the complexity of your
  # catalog, and I suspect beyond that, because that is, like, 10,000 calls
  # for 200 distinct objects.  Even with just linear, that is a constant
  # factor of, like, 50n. --daniel 2012-07-17
  def to_s
    @to_s ||= name.sub(/^completed_|^admissible_/, "")
  end
  alias path to_s

  def refresh
    # We don't do anything with them, but we need this to show that we are
    # "refresh aware" and not break the chain of propagation.
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
puppet-8.3.0 lib/puppet/type/whit.rb
puppet-8.3.0-x86-mingw32 lib/puppet/type/whit.rb
puppet-8.3.0-x64-mingw32 lib/puppet/type/whit.rb
puppet-8.3.0-universal-darwin lib/puppet/type/whit.rb
puppet-8.3.1 lib/puppet/type/whit.rb
puppet-8.3.1-x86-mingw32 lib/puppet/type/whit.rb
puppet-8.3.1-x64-mingw32 lib/puppet/type/whit.rb
puppet-8.3.1-universal-darwin lib/puppet/type/whit.rb
puppet-8.2.0 lib/puppet/type/whit.rb
puppet-8.2.0-x86-mingw32 lib/puppet/type/whit.rb
puppet-8.2.0-x64-mingw32 lib/puppet/type/whit.rb
puppet-8.2.0-universal-darwin lib/puppet/type/whit.rb
puppet-8.1.0 lib/puppet/type/whit.rb
puppet-8.1.0-x86-mingw32 lib/puppet/type/whit.rb
puppet-8.1.0-x64-mingw32 lib/puppet/type/whit.rb
puppet-8.1.0-universal-darwin lib/puppet/type/whit.rb
puppet-8.0.1 lib/puppet/type/whit.rb
puppet-8.0.1-x86-mingw32 lib/puppet/type/whit.rb
puppet-8.0.1-x64-mingw32 lib/puppet/type/whit.rb
puppet-8.0.1-universal-darwin lib/puppet/type/whit.rb