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

Base class events are not overrided in subclass. #70

Open
priyanghadevi1994 opened this issue Jun 25, 2021 · 0 comments
Open

Base class events are not overrided in subclass. #70

priyanghadevi1994 opened this issue Jun 25, 2021 · 0 comments

Comments

@priyanghadevi1994
Copy link

priyanghadevi1994 commented Jun 25, 2021

Description of the problem

Hi, I m using the inheritance approach for my problem. Both the base class and subclass share the same event. On triggering the event, I expected the transition in my subclass to get fired. But only the base class transition happens.

How would the new feature work?

Ideally, it would be effective to see the transitions and callbacks in the subclass overrides the base class incase of same event.

Example:

class GenericStateMachine < FiniteMachine::Definition
  initial :red

  event :start, :red => :green

  on_after_start { target.first_callback() }
end


class SpecificStateMachine < GenericStateMachine
  event :start, :red => :yellow

  on_after_start { target.second_callback() }
end

On triggering the event start, the state turns to yellow and second_callback method is invoked

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

No branches or pull requests

1 participant