Sha256: 6f0df4b70ee85a4fec16552e2e6d900a665fd8b1a9221e4e94d6a1be28dd24e7

Contents?: true

Size: 865 Bytes

Versions: 32

Compression:

Stored size: 865 Bytes

Contents

# frozen_string_literal: true

module Puppet::Pops
module Types
KEY_ANNOTATIONS = 'annotations'

# 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

32 entries across 32 versions & 1 rubygems

Version Path
puppet-8.10.0 lib/puppet/pops/types/annotatable.rb
puppet-8.10.0-x86-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-8.10.0-x64-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-8.10.0-universal-darwin lib/puppet/pops/types/annotatable.rb
puppet-8.9.0 lib/puppet/pops/types/annotatable.rb
puppet-8.9.0-x86-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-8.9.0-x64-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-8.9.0-universal-darwin lib/puppet/pops/types/annotatable.rb
puppet-8.8.1 lib/puppet/pops/types/annotatable.rb
puppet-8.8.1-x86-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-8.8.1-x64-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-8.8.1-universal-darwin lib/puppet/pops/types/annotatable.rb
puppet-8.7.0 lib/puppet/pops/types/annotatable.rb
puppet-8.7.0-x86-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-8.7.0-x64-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-8.7.0-universal-darwin lib/puppet/pops/types/annotatable.rb
puppet-8.6.0 lib/puppet/pops/types/annotatable.rb
puppet-8.6.0-x86-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-8.6.0-x64-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-8.6.0-universal-darwin lib/puppet/pops/types/annotatable.rb