Class: Refinery::VimeoVideos::URLTempfile

Inherits:
Tempfile
  • Object
show all
Defined in:
lib/refinerycms-vimeo-videos/url_tempfile.rb

Instance Method Summary collapse

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