SafeOstruct is a lightweight, dependency-free struct-like class backed by a plain symbol-keyed Hash. It supports dynamic attribute definition via keyword arguments, method-style and hash-style (symbol or string) access, and returns nil instead of raising NoMethodError for undefined attributes. Unlike OpenStruct, it never defines singleton methods, so instantiation stays fast and method caches stay intact.
Required Ruby Version
>= 3.0
Authors
Waqas Ali