howaboutwe/experimental — pull request #32 by bryanwoods (2014-02-19 19:39:12+00:00)
Title: Adds magic predicate methods for feature flipping

This is probably way too aggressive, but just opening a PR to discuss
implementing something like this. Essentially, I've noticed we've
started writing helper methods to determine a feature's visibility for a
user that look like this:

```ruby
def foo?
current_user.in_bucket?(:foo, 1)
end

def bar?
current_user.in_bucket?(:bar, 1)
end

```

So this change would allow you to call a predicate method matching the
desired experiment, eg:

```ruby
puts "Everything is free!!!!" if user.everything_free?
```

The most obvious downside is the hardcoded '1' for the 'on' bucket. This
is because the "onnyness" and "offyness" is currently in human-readable
text in the notes section of the YAML file. Codifying this in some way
like

```
some experiment:
on: 1
```

Would alleviate that, but not sure whether or not we see that direction
as beneficial.

I could also implement this in a much less extreme way -- wanted to open
a dialogue about whether or not this is even useful.