Se ho avuto il seguente hash rubino:Accesso a un hash di Ruby con una variabile come la chiave
environments = {
'testing' => '11.22.33.44',
'production' => '55.66.77.88'
}
Come dovrei accedere parti del hash di cui sopra? Un esempio sotto di ciò che sto cercando di ottenere.
current_environment = 'testing'
"rsync -ar [email protected]#{environments[#{testing}]}:/htdocs/"
Eccellente :) Grazie per la risposta. –
Sei il benvenuto! –