Module: Puppet::Pops::Types::PTupleType::ClassModule

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

Instance Method Summary collapse

Instance Method Details

#==(o) ⇒ Object



358
359
360
# File 'lib/puppet/pops/types/types.rb', line 358

def ==(o)
  self.class == o.class && types == o.types && size_type == o.size_type
end

#hashObject



354
355
356
# File 'lib/puppet/pops/types/types.rb', line 354

def hash
  [self.class, size_type, Set.new(types)].hash
end

#repeat_last_rangeObject

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



342
343
344
345
346
347
348
349
350
351
352
# File 'lib/puppet/pops/types/types.rb', line 342

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_rangeObject

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



334
335
336
337
# File 'lib/puppet/pops/types/types.rb', line 334

def size_range
  types_size = types.size
  size_type.nil? ? [types_size, types_size] : size_type.range
end