Module: Puppet::Pops::Types::PTupleType::ClassModule
- Defined in:
- lib/puppet/pops/types/types.rb
Instance Method Summary collapse
- #==(o) ⇒ Object
- #hash ⇒ Object
-
#repeat_last_range ⇒ Object
Returns the number of accepted occurrences [min, max] of the last type in the tuple The defaults is [1,1].
-
#size_range ⇒ Object
Returns the number of elements accepted [min, max] in the tuple.
Instance Method Details
#==(o) ⇒ Object
281 282 283 |
# File 'lib/puppet/pops/types/types.rb', line 281 def ==(o) self.class == o.class && types == o.types && size_type == o.size_type end |
#hash ⇒ Object
277 278 279 |
# File 'lib/puppet/pops/types/types.rb', line 277 def hash [self.class, size_type, Set.new(types)].hash end |
#repeat_last_range ⇒ Object
Returns the number of accepted occurrences [min, max] of the last type in the tuple The defaults is [1,1]
265 266 267 268 269 270 271 272 273 274 275 |
# File 'lib/puppet/pops/types/types.rb', line 265 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 ⇒ Object
Returns the number of elements accepted [min, max] in the tuple
257 258 259 260 |
# File 'lib/puppet/pops/types/types.rb', line 257 def size_range types_size = types.size size_type.nil? ? [types_size, types_size] : size_type.range end |