Skip to content

techthumb/hash-to-ostruct

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DESCRIPTION:

hash-to-ostruct recursively transforms Hash to OpenStruct

It supports:

  • hash of hashes

* hash of arrays with hashes as elements

SYNOPSIS:

# Example One: Hash of hashes require ‘hash-to-ostruct’

countries_hash = {} countries_hash = { :capital => ‘Canberra’, :currency_code => ‘AUD’ } countries_hash = { :capital => ‘London’, :currency_code => ‘GBP’ }

countries = countries_hash.to_ostruct

countries.australia.capital # returns “Canberra” countries.australia.currency_code # returns “AUD”

countries.england.capital # returns “London” countries.england.currency_code # returns “GBP”

INSTALL:

sudo gem install hash-to-ostruct

Copyright © 2009 Kunal Parikh ([email protected])

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages