A simple state machine for Ruby objects