There is a method in the StateMachine library to get the list of states:
ModelName.state_machines[:name_of_state].states.map &:name
or
ModelName.state_machines.states.map &:name
when the name of the attribute containing state is the default "state".
However, I was wondering whether there's a way to find the final statemachine, since if you draw them with
rake state_machine:draw FILE=model.rb CLASS=ModelName
the final states are double-circled. I was not able to get it from the rake task's source at first sight.
Getting the initial states seems to be easy:
ModelName.state_machines[:name_of_state].states.select(&:initial).map(&:name)
Update:
Oh, drats! It is as easy as:
ModelName.state_machines[:name_of_state].states.select(&:final?).map(&:name)
Left here for future Googlers!