In some of the previous "Hash access method" threads i've seen this sort
of thing:
a = "#{b}"
to assign the value of the variable b to a. My understanding is that
`#{var}' is string interpolation and that this would be a rather
indirect way of getting the value of `b'. The doc. seems to say that
string interpolation works by eval'ing the variable, so the direct (and
equivalent) way of doing this would be:
a = eval 'b'
Is this, in fact, the case? Are they exactly equivalent? And therefore
eval is to be preferred in this instance?
Next question: when `b' (above) is assigned to by, e.g. b = 'c',
exactly what method is being called by eval? Is it `to_s'? and
therefore, for string object `b' would all these be equivalent?
a = "#{b}" <=> a = eval 'b' <=> a = b.to_s
(I'm assuming that: b = 'c' creates object `b' as an instance of
class String. . . which i certainly _hope_ is correct :)
Answers/Comments/Clarifications?
craig