Advertisements
Offline
kbuttler
Posts: 1
Joined: Wed Nov 24, 2010 5:36 pm
Im seem to be having a bit of a problem with my program. i am setting an exception within a for loop and i cant seem to get the loop to stop instead I am getting syntax error, unexpected '\n', expecting tCOLON2 or '[' or '.' could any one tell what i am doing wrong. I left out the hard coded url for security purposes. but please let say thanks in advance for any help i could get.

for (1..7).each do |days_ago|
#here we take the file path from each customer and replace the day with todays date.
url = "sample url"
todays_url = url.gsub( '2010-10-01' ,y+"-"+m+"-"+d )

try_again = 0
time.now -1*60*60*24*days_ago

#this is where we want to check weather the file actually exist in the directory.
#here we will take the new url and retrive the new file from the server.
uri = todays_url
begin
source = open(uri)
rescue
try_again = 1
end
unless try_again == 0
break
end
end
exit