For reference I wrote this article about a year ago according to the commits at the astruct repo. I never submitted it because I got frustrated with the Ruby MRI source contribution process. astruct could definitely use some cleaning up, but actually runs much better in 2.1.0 so the details still stand.

Hello Ruby Core,

In this Pull Request I have made a series of changes that I would like to be added to the Ruby stdlib library ostruct. Before getting into anything I want to stress one thing: All changes are backwards compatible with the previous ostruct library. Any non-compatible changes are what I consider bug fixes and assumed behavior corrections.

First a list of problems with the current OpenStruct class:

Second, in order to address the issues I was having I first built a gem to solve my problem. All of the below things I’ve done have been done in this gem and remain readily available for your use.

In addition to fixing bugs, improving the interface and removing surprising behavior, I used two types of benchmarking: Benchmark#bmbm and Benchmark#ips (benchmark-ips gem), both showing favorable results for my version of ostruct. Here are the results