Class: Puppet::Pops::Types::PClassType

Inherits:
PCatalogEntryType show all
Defined in:
lib/puppet/pops/types/types.rb

Overview

Represents a (host-) class in the Puppet Language.

Constant Summary collapse

DEFAULT =
PClassType.new(nil)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from PCatalogEntryType

#instance?

Methods inherited from PAnyType

#==, #accept, #assignable?, #callable?, #callable_args?, #callable_with?, #check_self_recursion, create, #create, #generalize, #instance?, #iterable?, #iterable_type, #kind_of_callable?, #loader, #name, new_function, #new_function, #normalize, #really_instance?, #resolve, #roundtrip_with_string?, simple_name, #simple_name, #to_alias_expanded_s, #to_s

Methods inherited from TypedModelObject

_pcore_type, create_ptype, register_ptypes

Methods included from Visitable

#accept

Methods included from PuppetObject

#_pcore_all_contents, #_pcore_contents, #_pcore_init_hash, #_pcore_type

Constructor Details

#initialize(class_name) ⇒ PClassType

Returns a new instance of PClassType.



3047
3048
3049
# File 'lib/puppet/pops/types/types.rb', line 3047

def initialize(class_name)
  @class_name = class_name
end

Instance Attribute Details

#class_nameObject (readonly)



3036
3037
3038
# File 'lib/puppet/pops/types/types.rb', line 3036

def class_name
  @class_name
end

Class Method Details

.register_ptype(loader, ir) ⇒ Object



3038
3039
3040
3041
3042
3043
3044
3045
# File 'lib/puppet/pops/types/types.rb', line 3038

def self.register_ptype(loader, ir)
  create_ptype(loader, ir, 'CatalogEntryType',
    'class_name' => {
      KEY_TYPE => POptionalType.new(PStringType::NON_EMPTY),
      KEY_VALUE => nil
    }
  )
end

Instance Method Details

#eql?(o) ⇒ Boolean

Returns:

  • (Boolean)


3054
3055
3056
# File 'lib/puppet/pops/types/types.rb', line 3054

def eql?(o)
  self.class == o.class && @class_name == o.class_name
end

#hashObject



3051
3052
3053
# File 'lib/puppet/pops/types/types.rb', line 3051

def hash
  11 ^ @class_name.hash
end