Dynamically accessing Ruby JSON object variables : <pre><code>puts @file
# {
#   "0.js": "js/0.js",
#   "about-page.js": "js/about-page.js",
#   "img/heart.png": "img/ae985f1437f67f39c4393e31c6785970.png",
#   "index-page.js": "js/index-page.js",
#   "init.js": "js/init.js",
#   "main.js": "js/main.js"
# }
a = "0.js"
puts a // =&gt; "0.js"
puts @file[a] // =&gt; "0.js"  ????!!!???
</code></pre>

<p>Why the above code wouldn't work? I am expecting the last line to output <code>"js/0.js"</code> instead of <code>"0.js"</code>.</p>

<p>Thanks</p>
