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
299 300 301 |
# File 'lib/puppet/pops/types/types.rb', line 299 def ==(o) self.class == o.class && types == o.types && size_type == o.size_type end |
#hash ⇒ Object
295 296 297 |
# File 'lib/puppet/pops/types/types.rb', line 295 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]
283 284 285 286 287 288 289 290 291 292 293 |
# File 'lib/puppet/pops/types/types.rb', line 283 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
275 276 277 278 |
# File 'lib/puppet/pops/types/types.rb', line 275 def size_range types_size = types.size size_type.nil? ? [types_size, types_size] : size_type.range end |