Method: Puppet::Pops::Types::PTypeType#iterable_type

Defined in:
lib/puppet/pops/types/types.rb

#iterable_type(guard = nil) ⇒ Object



513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
# File 'lib/puppet/pops/types/types.rb', line 513

def iterable_type(guard = nil)
  # The types PIntegerType and PEnumType are Iterable
  case @type
  when PEnumType
    # @type describes the element type perfectly since the iteration is made over the
    # contained choices.
    PIterableType.new(@type)
  when PIntegerType
    # @type describes the element type perfectly since the iteration is made over the
    # specified range.
    @type.finite_range? ? PIterableType.new(@type) : nil
  else
    nil
  end
end