Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/elcuervo/machina
https://github.com/elcuervo/machina
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/elcuervo/machina
- Owner: elcuervo
- Created: 2021-01-25T18:07:21.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-06-28T21:15:04.000Z (over 2 years ago)
- Last Synced: 2024-11-28T23:28:26.392Z (about 1 month ago)
- Language: Ruby
- Size: 21.5 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Machina
_a god introduced by means of a crane in ancient Greek and Roman drama to decide the final outcome_
![](https://theatricaleffectsandstaging.files.wordpress.com/2016/05/untitled1.png?w=390&h=326)
```ruby
fsm = Machina.new(:unconfirmed)fsm.when[:welcome_email] = -> { send_welcome_email }
fsm.when[:enable_account] = -> (user) { user.enabled! }fsm[:confirm] = {
:unconfirmed => [:welcome_email, :enable_account, :confirmed],
}fsm.on[:confirm] = -> (user) { puts "Starting confirmation process for #{user.id}." }
fsm.state # => :unconfirmed
fsm.trigger!(:confirm, user)
fsm.state # => :confirmed
```