Project

recsym

0.0
No commit activity in last 3 years
No release in over 3 years
Recursively symbolize Hashes
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Gem Version

RecSym

Recursively Symbolize your Hashes!

Installation

gem install recsym

Usage

require 'recsym'

# Let's create some nested Hashes
# and Arrays.
x = {"foo" => [1, 2, {"bar" => 3}]}

# Now, let's make the data
# structure self-referential.
x["quuz"] = x
x["foo"].push x

# Can RecSym symbolize all of the
# Hash keys without entering an
# infinite recursion?  YES IT CAN!
y = RecSym.this(x)

puts y
puts(y[:quuz] == y)     # --> true
puts(y[:foo][3] == y)   # --> true