Simple FSM with events
Add this line to your application's Gemfile:
gem 'fsm'
And then execute:
$ bundle
Or install it yourself as:
$ gem install fsm
fsm = FSM.new(:initial_state).tap do |fsm|
fsm.when :event1, initial_state: :second_state
fsm.when :event2, second_state: :third_state
end
fsm.trigger(:event1)
puts fsm.state
Bug reports and pull requests are welcome on GitHub at https://github.com/UserAd/fsm. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.