Rick Carlino

Co-founder at FarmBot and Fox.Build Makerspace,

software historian, Open Source tinkerer.

[ 💬 Contact ] [ 👤 About ] [ 📰 Recent Reading ] [ ⌚ Now ]


Bravery: My Micro State Machine Library for Ruby.

I needed a dirt simple state machine that was flexible enough to meet the needs of some very ‘edge’ requirements in a project I recently worked on. I found that most of the Ruby state machines out there were making too many assumptions for the level of flexibility I needed. This weekend I wrote a small gem called Bravery.

It’s only ~55 lines of Ruby and it:

  • Tracks object state
  • Handles user-defined callback / validation behavior when entering a state
  • Absolutely nothing else (and that’s a good thing!)

Check it out on Github.