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

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

Instance Method Summary collapse

Instance Method Details

#==(o) ⇒ Object



296
297
298
# File 'lib/puppet/pops/types/types.rb', line 296

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

#hashObject



292
293
294
# File 'lib/puppet/pops/types/types.rb', line 292

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]



280
281
282
283
284
285
286
287
288
289
290
# File 'lib/puppet/pops/types/types.rb', line 280

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



272
273
274
275
# File 'lib/puppet/pops/types/types.rb', line 272

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