• Stars
    star
    1
  • Language
    Ruby
  • Created almost 2 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A State Machine library intended to be compatible with lightweight implementations of the Ruby language using 100LOC and only standard libraries.

MiniAASM

Gem Version Gem Build Status

A finite-state machine library intended to be compatible with lightweight implementations of the Ruby language using 100LOC and only standard libraries. Inspired by Heroku Postgres finite-state machine.

Usage

class TransmissionJob
  include MiniAASM

  aasm do
    state :transmitting, initial: true
    state :waiting_confirmation
    state :terminated

    event :work_succeeded do
      transitions from: :waiting_confirmation, to: :transmitting
      transitions from: :transmitting, to: :waiting_confirmation, guard: %i[hold?]
    end

    event :work_failed do
      transitions from: %i[transmitting waiting_confirmation], to: :terminated
    end
  end

  # ...
end

See test/support/transmission_job.rb.

> job = TransmissionJob.new
=> #<TransmissionJob:0x000056134d801450>
>  job.current_state
=> :transmitting
job.work_succeeded!
=> :waiting_confirmation
> job.work_succeeded!
=> :transmitting
> job.work_failed!
=> :terminated

Installation

Add this line to your application's Gemfile:

gem 'mini-aasm'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install mini-aasm

Development

After checking out the repo, run bin/setup to install dependencies. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/jamesmoriarty/mini-aasm.

More Repositories

1

forward-proxy

Minimal HTTP(S) forward proxy using 150LOC and only standard libraries.
Ruby
152
star
2

scorched_earth

Scorched Earth clone in JRuby with no dependencies.
Ruby
129
star
3

gohack

Experimental Go language CSGO exploit.
Go
68
star
4

lisp

Minimal Lisp interpreter using 75LOC and only standard libraries.
Ruby
52
star
5

gomem

A Go library for manipulating Windows processes.
Go
50
star
6

nebula

WebGL top down space shooter.
CoffeeScript
50
star
7

react-instagram-authless-feed

React component to provide a token-less Instagram feed.
JavaScript
49
star
8

cfn-cheapest-nat

Cheapest AWS VPC NAT.
36
star
9

angularjs-rss-reader

RSS reader in Javascript / AngularJS.
JavaScript
29
star
10

goforward

Go forward proxy with bandwidth limiting.
Go
27
star
11

poto

multi cloud storage to image gallery + image proxy + file api - 350 LOC.
Ruby
19
star
12

alpaca-desktop

Experimental OSX menu bar widget for Alpaca.
Ruby
19
star
13

call-graph

Capture execution and create dependency graphs.
Ruby
17
star
14

interceptor

Ruby method interceptors.
Ruby
10
star
15

trie

Ruby trie data structure.
Ruby
5
star
16

chingu-template

Simple template for a Chingu application.
Ruby
5
star
17

redux-paint

Simple "time-traveling" paint application.
TypeScript
5
star
18

simple-sinatra-sequel-blog

A simple blog with Sinatra and Sequel.
Ruby
4
star
19

tf-idf

Ruby Gem to calculate tf*idf
CSS
3
star
20

k8s-gitops

k8s gitops home lab.
Shell
3
star
21

gobackground

Golang, winuser.dll, advapi32.dll, to create a random unsplashed background binary.
Go
3
star
22

godll

Example of Go & Windows DLL build and usage.
Go
3
star
23

gobat2exe

Convert Windows batch files into executable files.
Go
3
star
24

vagrant-metasploit

2
star
25

pi-playbook

Configure Raspberry Pi with Ansible
2
star
26

chef-pptpd

Chef PPTPDrecipe.
Ruby
2
star
27

thread-pool

Ruby thread pool.
Ruby
2
star
28

gobot

Go learning exercise.
Go
1
star
29

cfn-static-website-with-lambda-at-edge

Static website hosted from an S3 Bucket delivered via Cloudfront with Lambda@Edge.
Shell
1
star
30

jamesmoriarty.github.io

Github Pages
HTML
1
star
31

cfn-vpc

A simple VPC including public and private subnets over multiple AZs.
1
star
32

react-email-signature

JavaScript
1
star
33

scala-robot

Scala
1
star
34

scheduler-dataflow-demo

Java
1
star
35

chef-minidlna

Chef MiniDLNA recipe.
Ruby
1
star
36

experiment-nginx-proxy-pass-forward-proxy

1
star
37

rack-playbook

Deploy compatible rack apps with ansible.
Ruby
1
star
38

docker-pmd

Dockerfile for PMD an extensible cross-language static code analyzer.
Dockerfile
1
star
39

kotlin-robot

Kotlin
1
star
40

victoria-exposure-site-bot

Ruby
1
star
41

chef-qt-webkit-devel

Ruby
1
star
42

experiment-dns-resolve

1
star
43

k3s-host-network-experiment

Why did my minidlna setup stop working?
Shell
1
star
44

experiment-fail-fast-mirroring

Shell
1
star