This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Found at http://www.dribin.org/dave/blog/archives/2006/11/17/hashes_to_ostruct/ | |
| require 'ostruct' | |
| def hashes2ostruct(object) | |
| return case object | |
| when Hash | |
| object = object.clone | |
| object.each do |key, value| | |
| object[key] = hashes2ostruct(value) |
NewerOlder