If you want to use something like this right now (with a threadsafe bonus) concurrent-ruby has some useful specialized structs that offer similar behavior:
* ImmutableStruct: Immutable struct where values are set at construction and cannot be changed later.
* MutableStruct: Synchronized, mutable struct where values can be safely changed at any time.
* SettableStruct: Synchronized, write-once struct where values can be set at most once, either at construction or any time thereafter.