Freeze Your Constants in Ruby

Close-up photograph of a ruby gemstone
Photo by Joshua Fuller on Unsplash

Years ago, I worked on a very large Ruby on Rails codebase that used constants to hold lists of credit card transaction states. For example:

However, we had a bug where a settled transaction would return true when txn.state.in? ACTIONABLE_STATES was called on it.