Enums in Ruby
Our enum type ServerState
has an underlying int
type.
By implementing the to_s
method in our enum class, we can convert values of ServerState
to strings.
The transition
function emulates a state transition for a server; it takes the existing state and returns a new state.