Class: Puppet::Pops::Types::PIterableType Private

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

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Constant Summary collapse

DEFAULT =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

PIterableType.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

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



866
867
868
# File 'lib/puppet/pops/types/types.rb', line 866

def element_type
  @type
end

#instance?(o) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
# File 'lib/puppet/pops/types/types.rb', line 870

def instance?(o)
  if @type.nil? || @type.assignable?(PAnyType::DEFAULT)
    # Any element_type will do
    case o
    when Iterable, String, Hash, Array, Range, PEnumType
      true
    when Integer
      o >= 0
    when PIntegerType
      o.finite_range?
    else
      false
    end
  else
    assignable?(TypeCalculator.infer(o))
  end
end

#iterable?(guard = nil) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


888
889
890
# File 'lib/puppet/pops/types/types.rb', line 888

def iterable?(guard = nil)
  true
end

#iterable_type(guard = nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



892
893
894
# File 'lib/puppet/pops/types/types.rb', line 892

def iterable_type(guard = nil)
  self
end