No commit activity in last 3 years
No release in over 3 years
Flatten nested hash with arrays into single level.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.0
~> 10.0
~> 3.0
 Project Readme

HashArrayFlatten

Flatten nested hash with arrays into single level.

https://rubygems.org/gems/hash_array_flatten

Usage

Nested hash

HashArrayFlatten.visit({"a" => {"x" => 1, "y" => 2}})
# => {"a.x"=>1, "a.y"=>2}

Nested hash with array

HashArrayFlatten.visit({"a" => {"aa" => 1, "ab" => 2}, "b" => [100, 200, {"c" => 300}]})
# => {"a.aa"=>1, "a.ab"=>2, "b.0"=>100, "b.1"=>200, "b.2.c"=>300}

License

MIT