module Puppet::Pops::Types::PIntegerType::ClassModule

Public Instance Methods

==(o) click to toggle source
# File lib/puppet/pops/types/types.rb, line 139
def ==(o)
  self.class == o.class && from == o.from && to == o.to
end
each() { |x| ... } click to toggle source

Returns Enumerator if no block is given Returns self if size is infinity (does not yield)

# File lib/puppet/pops/types/types.rb, line 129
def each
  return self.to_enum unless block_given?
  return nil if from.nil? || to.nil?
  from.upto(to) {|x| yield x }
end
hash() click to toggle source
# File lib/puppet/pops/types/types.rb, line 135
def hash
  [self.class, from, to].hash
end
range() click to toggle source

Returns the range as an array ordered so the smaller number is always first. The number may be Infinity or -Infinity.

# File lib/puppet/pops/types/types.rb, line 121
def range
  f = from || NEGATIVE_INFINITY
  t = to || INFINITY
  [f, t]
end
size() click to toggle source

Returns Float.Infinity if one end of the range is unbound

# File lib/puppet/pops/types/types.rb, line 114
def size
  return INFINITY if from.nil? || to.nil?
  1+(to-from).abs
end