1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
| tree_block = ->(hash,k){ hash[k] = Hash.new(&tree_block) }
opts = Hash.new(&tree_block)
opts['dev']['db']['host'] = "localhost:2828"
opts['dev']['db']['user'] = "me"
opts['dev']['db']['password'] = "secret"
opts['test']['db']['host'] = "localhost:2828"
opts['test']['db']['user'] = "test_user"
opts['test']['db']['password'] = "test_secret"
opts
# => {
"dev" => {
"db" => {
"host" => "localhost:2828",
"user" => "me",
"password" => "secret"
}
},
"test" => {
"db" => {
"host" => "localhost:2828",
"user" => "test_user",
"password" => "test_secret"
}
}
}
|