geekq / workflow

Ruby finite-state-machine-inspired API for modeling workflow
MIT License
1.75k stars 207 forks source link

Documentation for magic-state-checking methods #238

Open istrasci opened 8 months ago

istrasci commented 8 months ago

It seems that you can check if the object object/workflow is in a particular state by calling a magic state_name? method. Unless I'm missing something, all I see in the documentation regarding these magic methods is the following in the README:

Let’s create an article instance and check in which state it is:

article = Article.new
article.accepted? # => false
article.new? # => true

I was unaware of this functionality, and it recently got me into trouble in my app. I had defined a :started state, but also created my own method called started?. Only after debugging incorrect behaviour did I figure out my own method was not being called.

It would be nice if the documentation described this behaviour and explained it more clearly/explicitly.