Method: Puppet::Pops::Loader::TypedName#initialize

Defined in:
lib/puppet/pops/loader/typed_name.rb

#initialize(type, name, name_authority = Pcore::RUNTIME_NAME_AUTHORITY) ⇒ TypedName

Returns a new instance of TypedName.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/puppet/pops/loader/typed_name.rb', line 16

def initialize(type, name, name_authority = Pcore::RUNTIME_NAME_AUTHORITY)
  name = name.downcase
  @type = type
  @name_authority = name_authority
  # relativize the name (get rid of leading ::), and make the split string available
  parts = name.to_s.split(DOUBLE_COLON)
  if parts[0].empty?
    parts.shift
    @name = name[2..]
  else
    @name = name
  end
  @name_parts = parts.freeze

  # Use a frozen compound key for the hash and comparison. Most varying part first
  @compound_name = "#{@name}/#{@type}/#{@name_authority}"
  @hash = @compound_name.hash
  freeze
end