Walks nested hashes giving you the power to interact with its inner parts.
kazu@utopia:~/dev/git/walkash$ cat examples/walk_hash.rb
require 'rubygems' require 'walkash' require 'pp' hash = { 1 => { 2 => { 3 => { 4 => { 5 => { 6 => { 7 => { 8 => { 9 => {10 => { 'fix' => 'wrong', 'ignore' => 'wrong' }}}}}}}}}} } fix_wrong = lambda do |working_hash, key, value| working_hash[key] = 'correct' if (key == 'fix') && (value == 'wrong') end pp hash Walkash.walk(hash, [fix_wrong]) pp hash
kazu@utopia:~/dev/git/walkash$ ruby examples/walk_hash.rb
{1=> {2=> {3=> {4=> {5=>{6=>{7=>{8=>{9=>{10=>{"ignore"=>"wrong", "fix"=>"wrong"}}}}}}}}}}} {1=> {2=> {3=> {4=> {5=> {6=>{7=>{8=>{9=>{10=>{"ignore"=>"wrong", "fix"=>"correct"}}}}}}}}}}}
Copyright © 2012 kazuyoshi tlacaelel. See LICENSE.txt for further details.