Class: RImageAnalysisTools::URLImageReader

Inherits:
Object
  • Object
show all
Defined in:
lib/rimageanalysistools/image/io/url_image_reader.rb

Instance Method Summary collapse

Instance Method Details

#read(url) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/rimageanalysistools/image/io/url_image_reader.rb', line 31

def read(url)

	data = nil
	im = nil

	open(url) do |f|
		data = f.read
	end

	tf = Tempfile.new('url_image_reader')

	begin

		tf.write(data)
		im = RImageAnalysisTools.get_image(tf.path)

	ensure

		tf.close
		tf.unlink

	end

	im

end