pluginaweek/state_machine — pull request #231 by hlegius (2013-02-13 00:48:03+00:00)
Title: Added state checking at least support - state_from? method

Hello folks!

I've added a useful resource for "linear based" state machine: an option to check if some object has at least some state.

Motivation:

In one of my needs with state_machine, I'd like to check if my Customer is at least "paid", so, paid or any further states can be valid. Today, I need code something like that:

`if @customer.paid? or @customer.verified? or @customer.authorized?`

Instead, I wanna replace this painful task with something more encapsulated:

`if @customer.state_from?(:paid)`

More simple and readable, right? I've added it to state_machine gem with new unit and functional tests, that validates my code, following the project guidelines. I've updated the Readme.md to explain how to use this new feature.

As I explained in README file, this method is useful with "sequential" state machine. With "Vehicle", could be a little strange (I think, so).

Well. This is my contribution to the project. I read the code a lot before update something and I liked what a read. Very nice project.

If you guys have questions or improvements suggestions, please let me know. This is my first Ruby contribute to opensource. I did it before with PHP projects, but in Ruby is my first try =P

Thanks and keep goin'!