Help! what is going on here?

A

Andrew Walrond

$ cat test.rb
a = {{"hdparm"=>{"version"=>"5.8"}}=>"uri"}
puts("A.inspect " + a.inspect)

key = {'hdparm'=>{'version'=>'5.8'}}
puts("KEY.inspect " + key.inspect)

puts("a[key].inspect " + a[key].inspect)

# For some reason it works after doing this:
a.each {|key,uri| puts("sprinkle magic dust...") }

puts("a[key].inspect " + a[key].inspect)

$ ruby test.rb
A.inspect {{"hdparm"=>{"version"=>"5.8"}}=>"uri"}
KEY.inspect {"hdparm"=>{"version"=>"5.8"}}
a[key].inspect nil
sprinkle magic dust...
a[key].inspect "uri"

$ ruby --version
ruby 1.8.2 (2004-11-27) [i686-linux]

I'm going for a coffee!

Andrew Walrond
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,162
Latest member
GertrudeMa
Top