Skip to content

Instantly share code, notes, and snippets.

@simi
Created September 9, 2010 09:16
Show Gist options
  • Save simi/571634 to your computer and use it in GitHub Desktop.
Save simi/571634 to your computer and use it in GitHub Desktop.
def nest
a = full_key_array
x = {}; a[0..-2].inject(x) { |h,k| h[k.to_sym] = {} }[a[-1].to_sym] = value;
x
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment