-1

How do I insert

#{stock_sym}

into

stock_price = dom.xpath('//*[@id="yfs_l84_aapl"]').first.content

replacing aapl?

sawa
  • 165,429
  • 45
  • 277
  • 381
jmanikan
  • 37
  • 2

2 Answers2

4

String interpolation only works with double quotes:

"//*[@id='yfs_l84_#{stock_sym}']"
aerook
  • 268
  • 1
  • 3
  • 11
-1
stock_price = dom.xpath("//*[@id='yfs_l84_#{stock_sym}']").first.content
SoEzPz
  • 14,958
  • 8
  • 61
  • 64