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, #to_s

Constructor Details

#initialize(class_name) ⇒ PClassType

Returns a new instance of PClassType


3167
3168
3169
# File 'lib/puppet/pops/types/types.rb', line 3167

def initialize(class_name)
  @class_name = class_name
end

Instance Attribute Details

#class_nameObject (readonly)


3156
3157
3158
# File 'lib/puppet/pops/types/types.rb', line 3156

def class_name
  @class_name
end

Class Method Details

.register_ptype(loader, ir) ⇒ Object


3158
3159
3160
3161
3162
3163
3164
3165
# File 'lib/puppet/pops/types/types.rb', line 3158

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


3174
3175
3176
# File 'lib/puppet/pops/types/types.rb', line 3174

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

#hashObject


3171
3172
3173
# File 'lib/puppet/pops/types/types.rb', line 3171

def hash
  11 ^ @class_name.hash
end