I don’t have a specific purpose for this at the moment and the example I’m going to use definitely has better solutions (as this is unnecessary for something so simple) but I’d still like to see how this can be done. I’m wanting to populate a hash with dynamic symbols <-> content. Lets say I have a file that contains:
this = that
that = this
frog = taco
pota = to
I’m wanting to create the hash:
hash = { :this => 'that', :that => 'this', :frog => 'taco', :pota => 'to' }
I’m particular to it being symbols if it is possible, as I believe I’ve seen it done with variables. Since hash{variable => ‘this’} would set the contents of variable as the key.
1 Answer