Skip to content

Add #disabled? to DSL#94

Closed
liamwhite wants to merge 1 commit intoflippercloud:masterfrom
liamwhite:add-disabled-dsl
Closed

Add #disabled? to DSL#94
liamwhite wants to merge 1 commit intoflippercloud:masterfrom
liamwhite:add-disabled-dsl

Conversation

@liamwhite
Copy link
Copy Markdown

What it says on the tin.

DSL thing I thought should be added, since $flipper is used as a global in an app I code for, and !$flipper[:feature].enabled? is rather ugly, and you can't always use unless to negate stuff.

@jnunemaker
Copy link
Copy Markdown
Collaborator

Seems like the following would all work:

if $flipper[:feature].enabled?

end

unless $flipper[:feature].enabled?

end

if $flipper[:feature].enabled?

else

end

The only place I can think where you can't use enabled would be an if elsif else statement, though I haven't done that yet with a feature (doesn't mean it hasn't been done or shouldn't be done).

I think my main issue with adding this is that it could be confusing. Flipper is only about whether something is enabled or not, letting things through gates, not closing gates or keeping things out. Users of the gem have already been confused that they can't disable a feature for an individual thing. Adding disabled? could add to that as it provides a specific dsl method for checking disabled-ness, which flipper can't do. Thoughts?

@liamwhite
Copy link
Copy Markdown
Author

Hmm, I actually hadn't considered that Flipper isn't about boolean gates, but rather about custom logic gates that control the "enabled-ness" of a feature. I guess I'll close this and live with it.

@liamwhite liamwhite closed this Dec 8, 2015
@Marinlemaignan
Copy link
Copy Markdown

If i may, there definitely is use cases where that'd be awesome
if !Flipper[:feature].enabled?(user) || data['force']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants