class Determinator::TargetGroup
Attributes
constraints[R]
name[R]
rollout[R]
Public Class Methods
new(rollout:, name: '', constraints: {})
click to toggle source
# File lib/determinator/target_group.rb, line 5 def initialize(rollout:, name: '', constraints: {}) @name = name @rollout = rollout @constraints = constraints end
Public Instance Methods
==(other)
click to toggle source
# File lib/determinator/target_group.rb, line 31 def ==(other) return false unless other.is_a?(self.class) other.rollout == rollout && other.constraints == constraints end
humanize_percentage()
click to toggle source
# File lib/determinator/target_group.rb, line 19 def humanize_percentage (rollout_percent * 100).to_f.round(1) end
inspect()
click to toggle source
# File lib/determinator/target_group.rb, line 23 def inspect "<TG name:'#{name}': #{humanize_percentage}% of those matching: #{constraints}>" end
rollout_percent()
click to toggle source
# File lib/determinator/target_group.rb, line 11 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
to_explain_params()
click to toggle source
# File lib/determinator/target_group.rb, line 27 def to_explain_params { name: name, rollout_percent: humanize_percentage } end