Repository is archived
No commit activity in last 3 years
No release in over 3 years
Simple DSL for state machine classes
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.3
>= 0
>= 0
 Project Readme

Pretty State Machine Build Status

Simple FSM class-oriented DSL. Somewhere between MicroMachine and state_machine.

Usage

class Reznor < PrettyStateMachine::Machine
  state :up_above_it, initial: true

  state :down_in_it

  state :gave_up

  transition :get_down! do
    from :up_above_it
    to :down_in_it
  end

  transition :give_up! do
    from :up_above_it, :down_in_it
    to :gave_up
  end
end

>> machine = Reznor.new
>> machine.state.name
=> :up_above_it
>> machine.get_down!
>> machine.state.name
=> :down_in_it