code/superant.com.rwdmovies/downloadpic.rb in rwdmovies-0.93 vs code/superant.com.rwdmovies/downloadpic.rb in rwdmovies-0.94
- old
+ new
@@ -1,28 +1,26 @@
# download picture
- def downloadpicture
- require 'net/http'
- require 'uri'
- uri = @a_urlpicturename
- begin
- uri_parse = URI.parse(uri)
- host = uri_parse.host
- path = uri_parse.path
- response = nil
-
- http = Net::HTTP.start(host)
+def downloadpicture
+ require 'net/http'
+ require 'uri'
+ uri = @a_urlpicturename
+ begin
+ uri_parse = URI.parse(uri)
+ host = uri_parse.host
+ path = uri_parse.path
+ response = nil
-
- response = http.get(path)
-
- data = response.body
- File.open("/tmp/test.jpg", "w") { |f| f.write(data) }
- @listpicturesfromtmp = "picture downloaded"
+ http = Net::HTTP.start(host)
- rescue
- @listpicturesfromtmp = "error retrieving #{uri}:"
- end
-
-
- end
+ response = http.get(path)
+
+ data = response.body
+ File.open("/tmp/test.jpg", "w") { |f| f.write(data) }
+ @listpicturesfromtmp = "picture downloaded"
+
+ rescue
+ @listpicturesfromtmp = "error retrieving #{uri}:"
+ end
+
+end