Class: Puppet::Pops::Types::PIteratorType

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

Constant Summary collapse

DEFAULT =
PIteratorType.new(nil)

Instance Attribute Summary

Attributes inherited from PTypeWithContainedType

#type

Instance Method Summary collapse

Methods inherited from PTypeWithContainedType

#accept, #eql?, #generalize, #hash, #initialize, #normalize

Methods inherited from PAnyType

#==, #accept, #assignable?, #callable?, #callable_args?, #eql?, #generalize, #hash, #kind_of_callable?, #normalize, #simple_name, #to_alias_expanded_s, #to_s

Methods included from Visitable

#accept

Constructor Details

This class inherits a constructor from Puppet::Pops::Types::PTypeWithContainedType

Instance Method Details

#element_typeObject



915
916
917
# File 'lib/puppet/pops/types/types.rb', line 915

def element_type
  @type
end

#instance?(o) ⇒ Boolean

Returns:

  • (Boolean)


919
920
921
# File 'lib/puppet/pops/types/types.rb', line 919

def instance?(o)
  o.is_a?(Iterable) && (@element_type.nil? || @element_type.assignable?(o.element_type))
end

#iterable?(guard = nil) ⇒ Boolean

Returns:

  • (Boolean)


923
924
925
# File 'lib/puppet/pops/types/types.rb', line 923

def iterable?(guard = nil)
  true
end

#iterable_type(guard = nil) ⇒ Object



927
928
929
# File 'lib/puppet/pops/types/types.rb', line 927

def iterable_type(guard = nil)
  @type.nil? ? PIteratbleType::DEFAULT : PIterableType.new(@element_type)
end