Class: MiniDeploy::TemporaryFile
- Inherits:
-
Object
- Object
- MiniDeploy::TemporaryFile
- Defined in:
- lib/mini_deploy/temporary_file.rb
Instance Method Summary collapse
- #close ⇒ Object
- #current_path ⇒ Object
- #destroy ⇒ Object
- #done ⇒ Object
-
#initialize ⇒ TemporaryFile
constructor
A new instance of TemporaryFile.
- #write(data) ⇒ Object
Constructor Details
#initialize ⇒ TemporaryFile
Returns a new instance of TemporaryFile.
5 6 7 |
# File 'lib/mini_deploy/temporary_file.rb', line 5 def initialize @tempfile = Tempfile.new('mwd') end |
Instance Method Details
#close ⇒ Object
14 15 16 |
# File 'lib/mini_deploy/temporary_file.rb', line 14 def close @tempfile.close end |
#current_path ⇒ Object
29 30 31 |
# File 'lib/mini_deploy/temporary_file.rb', line 29 def current_path @tempfile.path end |
#destroy ⇒ Object
18 19 20 |
# File 'lib/mini_deploy/temporary_file.rb', line 18 def destroy @tempfile.unlink end |
#done ⇒ Object
22 23 24 25 26 27 |
# File 'lib/mini_deploy/temporary_file.rb', line 22 def done close destroy rescue StandardError => e # ignore end |
#write(data) ⇒ Object
9 10 11 12 |
# File 'lib/mini_deploy/temporary_file.rb', line 9 def write(data) @tempfile.write data @tempfile.rewind end |