Guest User

String interpolation

a guest
Jun 17th, 2013
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  addressFile = File.open("Alarm.txt")
  2.  
  3.   #temp = "100 Avery St" ## This works
  4.   #destination = temp.gsub!(' ','+')
  5.   address = addressFile.read()
  6.   destination = address.gsub!(' ','+') ##This doesnt work
  7.   addressFile.close()
  8.   uri =URI("http://open.mapquestapi.com/directions/v1/route?key=&ambiguities=ignore&from=1600+Spring+St,Parkersburg,WV&to=#{destination},Parkersburg,WV&callback=renderNarrative&outFormat=xml")
  9.   directions = Net::HTTP.get(uri)
  10.   file = File.open("directions.xml", 'w')
  11.   File.write(file, directions)
  12.   parseDirections()
Advertisement
Add Comment
Please, Sign In to add comment