Sha256: f7a020b6a6dfb03550ef98efbff7c8d47b0a7d109aa8f842a531697c4fb4c824

Contents?: true

Size: 872 Bytes

Versions: 96

Compression:

Stored size: 872 Bytes

Contents

module Puppet::Pops
module Types

KEY_ANNOTATIONS = 'annotations'.freeze

# Behaviour common to all Pcore annotatable classes
#
# @api public
module Annotatable
  TYPE_ANNOTATION_KEY_TYPE = PType::DEFAULT # TBD
  TYPE_ANNOTATION_VALUE_TYPE = PStructType::DEFAULT #TBD
  TYPE_ANNOTATIONS = PHashType.new(TYPE_ANNOTATION_KEY_TYPE, TYPE_ANNOTATION_VALUE_TYPE)

  # @return [{PType => PStructType}] the map of annotations
  # @api public
  attr_reader :annotations

  # @api private
  def init_annotatable(i12n_hash)
    @annotations = i12n_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 i12n_hash
    result = {}
    result[KEY_ANNOTATIONS] = @annotations unless @annotations.nil?
    result
  end
end
end
end

Version data entries

96 entries across 96 versions & 2 rubygems

Version Path
puppet-4.8.0 lib/puppet/pops/types/annotatable.rb
puppet-4.8.0-x86-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-4.8.0-x64-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-4.8.0-universal-darwin lib/puppet/pops/types/annotatable.rb
puppet-4.7.0 lib/puppet/pops/types/annotatable.rb
puppet-4.7.0-x86-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-4.7.0-x64-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-4.7.0-universal-darwin lib/puppet/pops/types/annotatable.rb
puppet-4.6.2 lib/puppet/pops/types/annotatable.rb
puppet-4.6.2-x86-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-4.6.2-x64-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-4.6.2-universal-darwin lib/puppet/pops/types/annotatable.rb
puppet-4.6.1-x86-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-4.6.1 lib/puppet/pops/types/annotatable.rb
puppet-4.6.1-x64-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-4.6.1-universal-darwin lib/puppet/pops/types/annotatable.rb