New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow threshold argument to passes_threshold?
to enable re-use in subclasses
#102
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,7 +55,7 @@ def enabled_for?(feature_recipient) | |
return false if feature_recipient.nil? | ||
return false if blacklisted?(feature_recipient) | ||
return true if whitelisted?(feature_recipient) | ||
passes_threshold?(feature_recipient) | ||
passes_threshold?(feature_recipient, self.deployment_percentage || 0) | ||
end | ||
|
||
def name | ||
|
@@ -81,8 +81,7 @@ def self.last_updated_at | |
|
||
protected | ||
|
||
def passes_threshold?(feature_recipient) | ||
threshold = self.deployment_percentage || 0 | ||
def passes_threshold?(feature_recipient, threshold) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a test that shows this usage ... or some docs why this is here would be nice There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's not a public interface, so a test feels inappropriate. What are you concretely asking for? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ... at least docs would be nice ... |
||
return true if threshold == 100 | ||
return false if threshold == 0 || !feature_recipient.id | ||
(((feature_recipient.id + (self.id || 1) + 17) * 13) % 100) < threshold | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for
self.