class Puppet::Pops::Types::TypeSetReference
Attributes
name[R]
type_set[R]
version_range[R]
Public Class Methods
new(owner, init_hash)
click to toggle source
# File lib/puppet/pops/types/type_set_reference.rb 12 def initialize(owner, init_hash) 13 @owner = owner 14 @name_authority = (init_hash[KEY_NAME_AUTHORITY] || owner.name_authority).freeze 15 @name = init_hash[KEY_NAME].freeze 16 @version_range = PSemVerRangeType.convert(init_hash[KEY_VERSION_RANGE]) 17 init_annotatable(init_hash) 18 end
Public Instance Methods
_pcore_init_hash()
click to toggle source
Calls superclass method
Puppet::Pops::Types::Annotatable#_pcore_init_hash
# File lib/puppet/pops/types/type_set_reference.rb 32 def _pcore_init_hash 33 result = super 34 result[KEY_NAME_AUTHORITY] = @name_authority unless @name_authority == @owner.name_authority 35 result[KEY_NAME] = @name 36 result[KEY_VERSION_RANGE] = @version_range.to_s 37 result 38 end
accept(visitor, guard)
click to toggle source
# File lib/puppet/pops/types/type_set_reference.rb 20 def accept(visitor, guard) 21 annotatable_accept(visitor, guard) 22 end
eql?(o)
click to toggle source
# File lib/puppet/pops/types/type_set_reference.rb 24 def eql?(o) 25 self.class == o.class && @name_authority.eql?(o.name_authority) && @name.eql?(o.name) && @version_range.eql?(o.version_range) 26 end
hash()
click to toggle source
# File lib/puppet/pops/types/type_set_reference.rb 28 def hash 29 [@name_authority, @name, @version_range].hash 30 end
resolve(loader)
click to toggle source
# File lib/puppet/pops/types/type_set_reference.rb 40 def resolve(loader) 41 typed_name = Loader::TypedName.new(:type, @name, @name_authority) 42 loaded_entry = loader.load_typed(typed_name) 43 type_set = loaded_entry.nil? ? nil : loaded_entry.value 44 45 raise ArgumentError, "#{self} cannot be resolved" if type_set.nil? 46 raise ArgumentError, "#{self} resolves to a #{type_set.name}" unless type_set.is_a?(PTypeSetType) 47 48 @type_set = type_set.resolve(loader) 49 unless @version_range.include?(@type_set.version) 50 raise ArgumentError, "#{self} resolves to an incompatible version. Expected #{@version_range}, got #{type_set.version}" 51 end 52 nil 53 end
to_s()
click to toggle source
# File lib/puppet/pops/types/type_set_reference.rb 55 def to_s 56 "#{@owner.label} reference to TypeSet named '#{@name}'" 57 end