Sha256: 020ea1a21771d7b586c9c0f8a8ab097828d5cfca311ea2533fad7386116e851b

Contents?: true

Size: 842 Bytes

Versions: 507

Compression:

Stored size: 842 Bytes

Contents

module Puppet::Pops
module Types

KEY_ANNOTATIONS = 'annotations'.freeze

# Behaviour common to all Pcore annotatable classes
#
# @api public
module Annotatable
  TYPE_ANNOTATIONS = PHashType.new(PTypeType.new(PTypeReferenceType.new('Annotation')), PHashType::DEFAULT)

  # @return [{PTypeType => PStructType}] the map of annotations
  # @api public
  def annotations
    @annotations.nil? ? EMPTY_HASH : @annotations
  end

  # @api private
  def init_annotatable(init_hash)
    @annotations = init_hash[KEY_ANNOTATIONS].freeze
  end

  # @api private
  def annotatable_accept(visitor, guard)
    @annotations.each_key { |key| key.accept(visitor, guard) } unless @annotations.nil?
  end

  # @api private
  def _pcore_init_hash
    result = {}
    result[KEY_ANNOTATIONS] = @annotations unless @annotations.nil?
    result
  end
end
end
end

Version data entries

507 entries across 507 versions & 2 rubygems

Version Path
puppet-7.29.1 lib/puppet/pops/types/annotatable.rb
puppet-7.29.1-x86-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-7.29.1-x64-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-7.29.1-universal-darwin lib/puppet/pops/types/annotatable.rb
puppet-7.29.0 lib/puppet/pops/types/annotatable.rb
puppet-7.29.0-x86-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-7.29.0-x64-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-7.29.0-universal-darwin lib/puppet/pops/types/annotatable.rb
puppet-7.28.0 lib/puppet/pops/types/annotatable.rb
puppet-7.28.0-x86-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-7.28.0-x64-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-7.28.0-universal-darwin lib/puppet/pops/types/annotatable.rb
puppet-7.27.0 lib/puppet/pops/types/annotatable.rb
puppet-7.27.0-x86-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-7.27.0-x64-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-7.27.0-universal-darwin lib/puppet/pops/types/annotatable.rb
puppet-7.26.0 lib/puppet/pops/types/annotatable.rb
puppet-7.26.0-x86-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-7.26.0-x64-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-7.26.0-universal-darwin lib/puppet/pops/types/annotatable.rb