Get list of state machines names provided by gem `aasm`

Hi! I’ve decided to change state machine provider gem in my framework Tramway from state_machine
gem to aasm
.
Reason
State machine is very OLD! I’ve been using version in this repo https://github.com/seuros/state_machine, because “official” version on Rubygems doesn’t support even Rails 4.2…
Why aasm?
For now, I think it’s the most stable state machine provider for Rails applications. IMHO
The main philosophy of the Tramway: it gives you a CRUD and easy-to-use state machines in your admin panel. That’s why I need access to every state machine method to build good enough GUI.
Well, I’ve met a little issue. How can we get all state machines defined in a model? aasm
suggest us to name state machines when we have more than one in a model.
Then we can just get a single state machine by its name with aasm
method SimpleMultipleExample.aasm(:move)
or get a default state_machine without name SimpleMultipleExample.aasm
according to documentation.
But what can we do if you want to iterate over the list of state machines?
I’ve explored the source code of the gem a little.
Here the answer :)
AASM::StateMachineStore.fetch(SimpleMultipleExample).machine_names
Magic!