Created
May 13, 2015 18:39
-
-
Save scarolan/76494d7af4c012d4ba6a to your computer and use it in GitHub Desktop.
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
The marketing department loves clowns and bears. | |
In case the syntax is confusing here, you can illustrate it using pry and a console, along with the "awesome_print" gem. Here's how you'd create this same data structure "by hand" | |
# chef gem install awesome_print | |
# pry | |
1] pry(main)> require "awesome_print" | |
=> true | |
[2] pry(main)> default = {} | |
=> {} | |
[3] pry(main)> default["apache"] = { 'sites' => { 'clowns' => { 'port' => 80 }, 'bears' => { 'port' => 81 } } } | |
=> {"sites"=>{"clowns"=>{"port"=>80}, "bears"=>{"port"=>81}}} | |
[4] pry(main)> ap default | |
{ | |
"apache" => { | |
"sites" => { | |
"clowns" => { | |
"port" => 80 | |
}, | |
"bears" => { | |
"port" => 81 | |
} | |
} | |
} | |
} | |
=> nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment