Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get list of event eligible events? #362

Open
gamesover opened this issue Nov 30, 2018 · 2 comments
Open

How to get list of event eligible events? #362

gamesover opened this issue Nov 30, 2018 · 2 comments

Comments

@gamesover
Copy link

gamesover commented Nov 30, 2018

event :start do
       transition :parked => :in_motion
    end

    event :stop do
       transition :in_motion => :parked
    end

    state(:in_motion, value: 0)

I want to get the list of eligible states, such as
MyClass.state_machine.events[:stop][:from], get result of [0]

@rocket-turtle
Copy link

I don't know if that is possible.

MyClass.state_machine.events[:stop].branches.flat_map(&:state_requirements).flat_map { |sr| sr[:from].description }.uniq
Something like this could help but there is a Problem mit StateMachines::BlacklistMatchers

@agbodike
Copy link

FYI: This gem is abandoned, it has been forked at: https://github.com/state-machines/state_machines

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants