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.10.8 lib/puppet/pops/types/annotatable.rb
puppet-4.10.8-x86-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-4.10.8-x64-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-4.10.8-universal-darwin lib/puppet/pops/types/annotatable.rb
puppet-4.10.7 lib/puppet/pops/types/annotatable.rb
puppet-4.10.7-x86-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-4.10.7-x64-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-4.10.7-universal-darwin lib/puppet/pops/types/annotatable.rb
puppet-4.10.6 lib/puppet/pops/types/annotatable.rb
puppet-4.10.6-x86-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-4.10.6-x64-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-4.10.6-universal-darwin lib/puppet/pops/types/annotatable.rb
puppet-4.10.5 lib/puppet/pops/types/annotatable.rb
puppet-4.10.5-x86-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-4.10.5-x64-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-4.10.5-universal-darwin lib/puppet/pops/types/annotatable.rb
puppet-4.10.4 lib/puppet/pops/types/annotatable.rb
puppet-4.10.4-x86-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-4.10.4-x64-mingw32 lib/puppet/pops/types/annotatable.rb
puppet-4.10.4-universal-darwin lib/puppet/pops/types/annotatable.rb