Skip to content

Commit

Permalink
rubocop happy
Browse files Browse the repository at this point in the history
  • Loading branch information
gardleopard committed Aug 22, 2023
1 parent 47d1859 commit 4707a7b
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions lib/unleash/feature_toggle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,17 @@ def am_enabled(context)
strategy: false,
variants: self.variant_definitions
}
if self.enabled
if self.strategies.empty?
return returnable unless self.enabled

if self.strategies.empty?
returnable[:result] = true
else
returnable[:strategy] = self.strategies.find(proc{ false }) do |s|
(strategy_enabled?(s, context) && strategy_constraint_matches?(s, context))
end
if returnable[:strategy]
returnable[:variants] = returnable[:strategy].variants if returnable[:strategy].variants
returnable[:result] = true
else
returnable[:strategy] = self.strategies.find(proc{ false }){ |s| (strategy_enabled?(s, context) && strategy_constraint_matches?(s, context)) }
if returnable[:strategy]
returnable[:variants] = returnable[:strategy].variants if returnable[:strategy].variants
returnable[:result] = true
end
end
end

Expand Down

0 comments on commit 4707a7b

Please sign in to comment.