Skip to content

Instantly share code, notes, and snippets.

@scarolan
Created May 13, 2015 18:39
Show Gist options
  • Save scarolan/76494d7af4c012d4ba6a to your computer and use it in GitHub Desktop.
Save scarolan/76494d7af4c012d4ba6a to your computer and use it in GitHub Desktop.
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