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.



3164
3165
3166
# File 'lib/puppet/pops/types/types.rb', line 3164

def initialize(class_name)
  @class_name = class_name
end

Instance Attribute Details

#class_nameObject (readonly)



3153
3154
3155
# File 'lib/puppet/pops/types/types.rb', line 3153

def class_name
  @class_name
end

Class Method Details

.register_ptype(loader, ir) ⇒ Object



3155
3156
3157
3158
3159
3160
3161
3162
# File 'lib/puppet/pops/types/types.rb', line 3155

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)


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

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

#hashObject



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

def hash
  11 ^ @class_name.hash
end