Skip to content
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

Feature Check Context #158

Merged
merged 16 commits into from
Sep 24, 2016
Merged

Feature Check Context #158

merged 16 commits into from
Sep 24, 2016

Conversation

jnunemaker
Copy link
Collaborator

Sometimes when checking if a group should be enabled or not you just want a little extra context about the current check. This allows the group check to know which feature is being checked and what the gate values are for that feature. It allows for more advanced/crazy things. Should be backwards compatible, so if you don't need the context, just don't use it. I included an example for those that are curious.

I don't see a reason to keep this here and I'm not sure why I added it.
https://travis-ci.org/jnunemaker/flipper/jobs/159306226

```
$ bundle exec rake
/home/travis/.rvm/rubies/ruby-2.0.0-p648-clang/bin/ruby -I/home/travis/.rvm/gems/ruby-2.0.0-p648-clang/gems/rspec-core-3.5.3/lib:/home/travis/.rvm/gems/ruby-2.0.0-p648-clang/gems/rspec-support-3.5.0/lib /home/travis/.rvm/gems/ruby-2.0.0-p648-clang/gems/rspec-core-3.5.3/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb --color
/home/travis/build/jnunemaker/flipper/lib/flipper/feature.rb:4:in `require': /home/travis/build/jnunemaker/flipper/lib/flipper/gate_context.rb:6: syntax error, unexpected ',' (SyntaxError)
    def initialize(values:, feature_name:)
                           ^
/home/travis/build/jnunemaker/flipper/lib/flipper/gate_context.rb:11: syntax error, unexpected keyword_end, expecting end-of-input
```

The easy way around it is to just use a hash with fetch which raises KeyError for missing key.
thing and context were always together so I might as well collapse them.
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.

1 participant