Class: Puppet::Pops::Types::PType
Overview
Constant Summary
collapse
- DEFAULT =
PType.new(nil)
Instance Attribute Summary
#type
Instance Method Summary
collapse
#accept, #generalize, #hash, #initialize, #normalize
Methods inherited from PAnyType
#==, #accept, #assignable?, #callable?, #callable_args?, #generalize, #hash, #kind_of_callable?, #normalize, #to_alias_expanded_s, #to_s
Methods included from Visitable
#accept
Instance Method Details
#eql?(o) ⇒ Boolean
374
375
376
|
# File 'lib/puppet/pops/types/types.rb', line 374
def eql?(o)
self.class == o.class && @type == o.type
end
|
#instance?(o) ⇒ Boolean
339
340
341
342
343
344
345
|
# File 'lib/puppet/pops/types/types.rb', line 339
def instance?(o)
if o.is_a?(PAnyType)
type.nil? || type.assignable?(o)
else
assignable?(TypeCalculator.infer(o))
end
end
|
#iterable?(guard = nil) ⇒ Boolean
347
348
349
350
351
352
353
354
355
356
|
# File 'lib/puppet/pops/types/types.rb', line 347
def iterable?(guard = nil)
case @type
when PEnumType
true
when PIntegerType
@type.finite_range?
else
false
end
end
|
#iterable_type(guard = nil) ⇒ Object
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
|
# File 'lib/puppet/pops/types/types.rb', line 358
def iterable_type(guard = nil)
case @type
when PEnumType
PIterableType.new(@type)
when PIntegerType
@type.finite_range? ? PIterableType.new(@type) : nil
else
nil
end
end
|
#simple_name ⇒ Object
378
379
380
381
|
# File 'lib/puppet/pops/types/types.rb', line 378
def simple_name
'Type'
end
|