The project is in a healthy, maintained state
Converts nested Ruby hashes and arrays into struct-like objects.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

dorian-to_struct

Convert Ruby hashes and arrays into struct-like objects.

Install

gem install dorian-to_struct

Also included in the aggregate gem:

gem install dorian

Usage

to_struct -h

Run to_struct -h for generated option details and to_struct -v for the installed version.

Notes

  • The executable only exposes help/version. The useful API is loaded with require "dorian/to_struct".

Examples

Access hash keys as methods

require "dorian/to_struct"

user = { "name" => "Dorian" }.to_struct
user.name # => "Dorian"
user.from_struct # => { "name" => "Dorian" }