Class: Unleash::Strategy::UserWithId
- Defined in:
- lib/unleash/strategy/user_with_id.rb
Constant Summary collapse
- PARAM =
'userIds'.freeze
Instance Method Summary collapse
-
#is_enabled?(params = {}, context = nil) ⇒ Boolean
requires: params, context.user_id,.
- #name ⇒ Object
Instance Method Details
#is_enabled?(params = {}, context = nil) ⇒ Boolean
requires: params, context.user_id,
11 12 13 14 15 16 17 |
# File 'lib/unleash/strategy/user_with_id.rb', line 11 def is_enabled?(params = {}, context = nil) return false unless params.is_a?(Hash) && params.has_key?(PARAM) return false unless params.fetch(PARAM, nil).is_a? String return false unless context.instance_of?(Unleash::Context) params[PARAM].split(",").map(&:strip).include?(context.user_id) end |
#name ⇒ Object
6 7 8 |
# File 'lib/unleash/strategy/user_with_id.rb', line 6 def name 'userWithId' end |