The operation #{ } appears to be so fundamental that my Ruby book completely skips its definition. Can someone provide an explanation?
#{ }
This is a tough question to Google for unless you know the right search terms. The #{} operator technically performs expression substitution inside a string literal.
#{}
The #{} literal is the operator used for interpolation inside double-quoted strings the same way that the backticks or $() construct would be used in Bash. From a practical point of view, the expression inside the literal is evaluated, and then the entire #{} expression (including both the operator and the expression it contains) is replaced in situ with the result.
$()
2.1m questions
2.1m answers
60 comments
57.0k users