luisobo/StateMachine — pull request #1 by iceydee (2013-01-04 14:37:41+00:00)
Title: Transition conditions

I've added the possibility to provide a special condition for a transition to be valid. This is similar to what the ruby state_machine gem also provides. I added it as a third optional parameter called "if" with a new block typedef that returns a BOOL.

Example:

[sm when:@"activate" transitionFrom:@"pending" to:@"active" if:^BOOL(LSStateMachine *stateMachine) {
// Run your custom condition check here.
if (YES) {
return YES;
}
return NO;
}];