0.0
The project is in a healthy, maintained state
Utility for traversing hashes and arrays.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.0
 Project Readme

Structverse

Structverse provides a simple way to walk through tyhe structure of a hash or array. Call Structverse.walk, passing in the hash or array. The walk method will return each hash and array in the structure. Only hashes as arrays are returned.

#!/usr/bin/ruby -w
require 'structverse'

hsh = {
  "Puck": true,
  
  "Oberon": {
    "Titania": [
        "Peaseblossom",
        "Mustardseed",   
        { "Mote": true },
        [ "Bottom", "Flute" ]
      ]
  }
}

Structverse.walk(hsh) do |struct|
  puts struct.class
end

# => Hash
# => Hash
# => Array
# => Hash
# => Array

Installation

The usual:

sudo gem install structverse

Or however you like to installgems. It's just a single file.

Author

Mike O'Sullivan mike@idocs.com

History

version date notes
1.0 June 22, 2023 Initial upload.