new_file/common: simplify empty class declarations
[ruby-mogilefs-client.git] / lib / mogilefs / new_file / tempfile.rb
blobecec02ed448aa9d15a80738e0af816244f63f234
1 # -*- encoding: binary -*-
2 # here are internal implementation details, do not rely on them in your code
3 require 'tempfile'
4 require 'mogilefs/http_file'
6 class MogileFS::NewFile::Tempfile < Tempfile
7   def initialize(*args)
8     @mogilefs_httpfile_args = args
9     super("mogilefs-client")
10     unlink
11   end
13   def commit
14     rewind
15     tmp = MogileFS::HTTPFile.new(*@mogilefs_httpfile_args)
16     tmp.big_io = to_io
17     tmp.commit
18   end
20   def close
21     commit
22     super
23   end
24 end