Class: Puppet::Pops::Types::PRuntimeType

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

Constant Summary collapse

DEFAULT =
PRuntimeType.new(nil)

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from PAnyType

#assignable?, #callable?, #callable_args?, #enumerable?, #generalize, #kind_of_callable?, #simple_name, #to_s

Methods included from Visitable

#accept

Constructor Details

#initialize(runtime, runtime_type_name = nil) ⇒ PRuntimeType

Returns a new instance of PRuntimeType.



1386
1387
1388
1389
# File 'lib/puppet/pops/types/types.rb', line 1386

def initialize(runtime, runtime_type_name = nil)
  @runtime = runtime
  @runtime_type_name = runtime_type_name
end

Instance Attribute Details

#runtimeObject (readonly)



1384
1385
1386
# File 'lib/puppet/pops/types/types.rb', line 1384

def runtime
  @runtime
end

#runtime_type_nameObject (readonly)



1384
1385
1386
# File 'lib/puppet/pops/types/types.rb', line 1384

def runtime_type_name
  @runtime_type_name
end

Instance Method Details

#==(o) ⇒ Object



1395
1396
1397
# File 'lib/puppet/pops/types/types.rb', line 1395

def ==(o)
  self.class == o.class && @runtime == o.runtime && @runtime_type_name == o.runtime_type_name
end

#hashObject



1391
1392
1393
# File 'lib/puppet/pops/types/types.rb', line 1391

def hash
  @runtime.hash * 31 + @runtime_type_name.hash
end

#instance?(o) ⇒ Boolean

Returns:

  • (Boolean)


1399
1400
1401
# File 'lib/puppet/pops/types/types.rb', line 1399

def instance?(o)
  assignable?(TypeCalculator.infer(o))
end