Class: Unleash::Strategy::GradualRolloutSessionId
- Defined in:
- lib/unleash/strategy/gradual_rollout_sessionid.rb
Instance Method Summary collapse
Instance Method Details
#is_enabled?(params = {}, context = nil) ⇒ Boolean
11 12 13 14 15 16 17 18 |
# File 'lib/unleash/strategy/gradual_rollout_sessionid.rb', line 11 def is_enabled?(params = {}, context = nil) return false unless params.is_a?(Hash) && params.has_key?('percentage') return false unless context.instance_of?(Unleash::Context) return false if context.session_id.nil? || context.session_id.empty? percentage = Integer(params['percentage'] || 0) (percentage.positive? && Util.get_normalized_number(context.session_id, params['groupId'] || "") <= percentage) end |
#name ⇒ Object
6 7 8 |
# File 'lib/unleash/strategy/gradual_rollout_sessionid.rb', line 6 def name 'gradualRolloutSessionId' end |