Guest User

String interpolation

a guest
Jun 17th, 2013
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 0.53 KB | None | 0 0
  1. I am using Net::HTTP.get(uri) with the following uri
  2. "http://mapquestapi.com/directions/v1/route?key&fro...
  3.  
  4. The problem is with the #{destination}
  5.  
  6.  
  7.  addressFile = File.open("Alarm.txt")#File contains the text 100 Avery
  8. St
  9.  address = addressFile.read()
  10.  puts address
  11.  destination = address.gsub!(' ','+')
  12.  addressFile.close()
  13.  
  14. When I try to interpolate the destination variable like this I get a
  15. format
  16. error. However this works..
  17.  
  18.  address = "100 Avery St"
  19.  destination = address.gsub!(' ','+')
  20.  
  21. What am I missing?
Advertisement
Add Comment
Please, Sign In to add comment