Sha256: 7908e0153f18282ccbc3814bc38b324b61233825faedce5f14b12a88535c1ac5
Contents?: true
Size: 724 Bytes
Versions: 9
Compression:
Stored size: 724 Bytes
Contents
require 'unleash/strategy/util' module Unleash module Strategy class GradualRolloutUserId < Base def name 'gradualRolloutUserId' end # need: params['percentage'], params['groupId'], context.user_id, def is_enabled?(params = {}, context = nil, _constraints = []) return false unless params.is_a?(Hash) && params.has_key?('percentage') return false unless context.class.name == 'Unleash::Context' return false if context.user_id.nil? || context.user_id.empty? percentage = Integer(params['percentage'] || 0) (percentage.positive? && Util.get_normalized_number(context.user_id, params['groupId'] || "") <= percentage) end end end end
Version data entries
9 entries across 9 versions & 1 rubygems