4

Recently I shifted to Ruby 2.0.0 from Ruby 1.9.3.

In 1.9.3 we were used to perform string interpolation using: 'http://#{get_host_name}.com, but since moving to 2.0.0, it seems to be not working.

Can anyone tell me if the syntax changed? How can I perform string interpolation in Ruby 2.0.0?

4

1 回答 1

16

无论您使用的是哪个版本的 Ruby,字符串插值都不会发生在单引号字符串中。使用双引号字符串或%Q-style 字符串。

于 2013-07-25T07:11:08.793 回答