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?

1 Answer 1

16

Regardless of which version of Ruby you're using, string interpolation doesn't happen in single-quoted strings. Use double-quoted strings or %Q-style strings.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.