mceachen/closure_tree — pull request #34 by elskwid (2012-12-30 23:43:03+00:00)
Title: Use `build_nested_hash` to create hash trees

Comments and code from: https://github.com/elskwid/closure_tree/commit/a57b3b84aa0e1060de32de6fdf7a7a9ac843b50f

This implements `build_nested_hash` method that takes a block that returns a scope and makes a pretty nested hash. A few tweaks in this version,

* Returns an empty hash if a block is not given this is just a little clearer using `return` instead of the `if`
* Class method is a little noisier given we're working with the nested select
* Default `limit_depth` is removed as discussed here: https://github.com/elskwid/closure_tree/commit/a57b3b84aa0e1060de32de6fdf7a7a9ac843b50f#commitcomment-2367578