Implement #validate
Refactor #when and #when_not in terms of #validate