Created
April 10, 2013 15:23
-
-
Save daviddavis/5355593 to your computer and use it in GitHub Desktop.
update a nested hash
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
| parameters = {:units => [ | |
| { | |
| :name => "wat", | |
| :blah => "ok" | |
| }, | |
| { | |
| :name => "foo", | |
| :max_version => 2 | |
| } | |
| ]} | |
| # here we go | |
| parameters[:units].detect{|hsh| hsh[:name] == "foo"}.merge!(max_version: 10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment