Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save awesome/3842062 to your computer and use it in GitHub Desktop.

Select an option

Save awesome/3842062 to your computer and use it in GitHub Desktop.
Build A Hash Tree From Array Of File Names In Ruby
# http://www.dzone.com/snippets/build-hash-tree-array-file
Dir["**/*"].inject({}) {|h,i| t = h; i.split("/").each {|n| t[n] ||= {}; t = t[n]}; h}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment