Skip to content

Instantly share code, notes, and snippets.

@capoferro
Created January 29, 2013 20:15
Show Gist options
  • Select an option

  • Save capoferro/4667355 to your computer and use it in GitHub Desktop.

Select an option

Save capoferro/4667355 to your computer and use it in GitHub Desktop.
Hash.from_dotted_path(:'a.b.c', "value")
#=> {:a => {:b => {:c => "value"}}}
or
#=> {"a" => {"b" => {"c" => "value"}}}
# Passing a string as a first parameter will always return the second. Note that the first parameter in the example above is a Symbol. Wondering if this method should return what's passed in or return strings as keys always.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment