Order State This is an example State Pattern implementation for Ruby (on Rails). The main class implements methods which might change state by wrapping the state transition code in a block that is passed to the State object.