Module: Puppet::Pops::Types::Annotatable
- Included in:
- PMetaType, PObjectType::PAnnotatedMember, TypeSetReference
- Defined in:
- lib/puppet/pops/types/annotatable.rb
Overview
Behaviour common to all Pcore annotatable classes
Constant Summary collapse
- TYPE_ANNOTATIONS =
PHashType.new(PTypeType.new(PTypeReferenceType.new('Annotation')), PHashType::DEFAULT)
Instance Method Summary collapse
- #_pcore_init_hash ⇒ Object private
- #annotatable_accept(visitor, guard) ⇒ Object private
-
#annotations ⇒ {PTypeType => PStructType}
The map of annotations.
- #init_annotatable(init_hash) ⇒ Object private
Instance Method Details
#_pcore_init_hash ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
30 31 32 33 34 |
# File 'lib/puppet/pops/types/annotatable.rb', line 30 def _pcore_init_hash result = {} result[KEY_ANNOTATIONS] = @annotations unless @annotations.nil? result end |
#annotatable_accept(visitor, guard) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
25 26 27 |
# File 'lib/puppet/pops/types/annotatable.rb', line 25 def annotatable_accept(visitor, guard) @annotations.each_key { |key| key.accept(visitor, guard) } unless @annotations.nil? end |
#annotations ⇒ {PTypeType => PStructType}
Returns the map of annotations.
15 16 17 |
# File 'lib/puppet/pops/types/annotatable.rb', line 15 def annotations @annotations.nil? ? EMPTY_HASH : @annotations end |
#init_annotatable(init_hash) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
20 21 22 |
# File 'lib/puppet/pops/types/annotatable.rb', line 20 def init_annotatable(init_hash) @annotations = init_hash[KEY_ANNOTATIONS].freeze end |