Class: Unleash::Strategy::GradualRolloutRandom
- Defined in:
- lib/unleash/strategy/gradual_rollout_random.rb
Instance Method Summary collapse
Instance Method Details
#is_enabled?(params = {}, _context = nil) ⇒ Boolean
need: params
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/unleash/strategy/gradual_rollout_random.rb', line 11 def is_enabled?(params = {}, _context = nil) return false unless params.is_a?(Hash) && params.has_key?('percentage') begin percentage = Integer(params['percentage'] || 0) rescue ArgumentError return false end (percentage >= Random.rand(1..100)) end |
#name ⇒ Object
6 7 8 |
# File 'lib/unleash/strategy/gradual_rollout_random.rb', line 6 def name 'gradualRolloutRandom' end |