geekq / workflow

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

previous state? #237

Closed chrishough closed 11 months ago

chrishough commented 1 year ago

Before I consider adding a patch to the library, I was curious if we have ever considered having an instance method like current_state that would be previous_state?

geekq commented 1 year ago

Nope, did not consider yet. If you need it for your use case, you could use the on_transition hook https://github.com/geekq/workflow#on_transition to save the previous state to some instance variable.

chrishough commented 11 months ago

Thank you @geekq we can use that!