module Puppet::Pops::Types::PTupleType::ClassModule

Public Instance Methods

==(o) click to toggle source
# File lib/puppet/pops/types/types.rb, line 287
def ==(o)
  self.class == o.class && types == o.types && size_type == o.size_type
end
hash() click to toggle source
# File lib/puppet/pops/types/types.rb, line 283
def hash
  [self.class, size_type, Set.new(types)].hash
end
repeat_last_range() click to toggle source

Returns the number of accepted occurrences [min, max] of the last type in the tuple The defaults is [1,1]

# File lib/puppet/pops/types/types.rb, line 271
def repeat_last_range
  types_size = types.size
  if size_type.nil?
    return [1, 1]
  end
  from, to = size_type.range()
  min = from - (types_size-1)
  min = min <= 0 ? 0 : min
  max = to - (types_size-1)
  [min, max]
end
size_range() click to toggle source

Returns the number of elements accepted [min, max] in the tuple

# File lib/puppet/pops/types/types.rb, line 263
def size_range
  types_size = types.size
  size_type.nil? ? [types_size, types_size] : size_type.range
end