Add `when` method to allow for conditional rules - ref #194

I'm not sure if this was the desired API, but it was the only one proposed and it covers my use case.