Class: Refinery::VimeoVideos::URLTempfile
- Inherits:
-
Tempfile
- Object
- Tempfile
- Refinery::VimeoVideos::URLTempfile
- Defined in:
- lib/refinerycms-vimeo-videos/url_tempfile.rb
Instance Method Summary collapse
-
#initialize(url) ⇒ URLTempfile
constructor
A new instance of URLTempfile.
Constructor Details
#initialize(url) ⇒ URLTempfile
Returns a new instance of URLTempfile.
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/refinerycms-vimeo-videos/url_tempfile.rb', line 5 def initialize(url) @url = URI.parse(url) begin super('url', Dir.tmpdir, :encoding => 'ascii-8bit') Net::HTTP.start(@url.host) do |http| resp = http.get(@url.path) self.write resp.body end ensure end end |