Sha256: 8661085bf74b3d0cd18aa0e1060a3e32d45cc06521ab74ebe5e4528ed3b142e6
Contents?: true
Size: 779 Bytes
Versions: 31
Compression:
Stored size: 779 Bytes
Contents
module Determinator class TargetGroup attr_reader :rollout, :constraints def initialize(rollout:, constraints: {}) @rollout = rollout @constraints = constraints end def rollout_percent # Rollout is out of 65536 because the highest rollout indicator # (which is a 16 bit integer) can be is 65,535. 100% rollout # needs to include the highest indicator, and 0% needs to not include # the lowest indicator. Rational(rollout, 65_536) end def inspect pc = (rollout_percent * 100).to_f.round(1) "<#{pc}% of those matching: #{constraints}>" end def ==(other) return false unless other.is_a?(self.class) other.rollout == rollout && other.constraints == constraints end end end
Version data entries
31 entries across 31 versions & 1 rubygems