Prime
2/21/2007 2:11:00 AM
I do not know if this will help you out, I think this is what you
wanted. This only calls the downloadImg method if the file exists.
@domains = ['yahoo.com','google.com']
def checkCache(filename)
if File.exists?(filename)
return true
else
return false
end
end
def downloadImg(name)
puts "called the download function"
end
@domains.each do |domain|
if checkCache(domain)
downloadImg(domain)
end
end
On 2007-02-20 17:51:48 -0800, Chris Gallagher <cgallagher@gmail.com> said:
> well the reason im doing this is for refoactoring purposes so my code is
> chaning a lot.
>
> What I have at the moment is:
>
> file = 'public/images/' + source_url + '.jpg'
> if ((FileTest.exists?(file))&&((Time.new-File.stat(file).mtime)<
> 50000))
>
>
>
> .................
>
> Im guessing I can stick a 'return true' just below that or does it work
> that way?