Debugfile
Debugfile stores temporary file for debugging, based on ruby/mri/lib/tempfile.rb
You can store files in your tmporary directory orderd by date. For example, when you file uploader fails to complete uploading process, you can get the file for debug.
Installation
Add this line to your application's Gemfile:
gem 'debugfile'
And then execute:
$ bundle
Or install it yourself as:
$ gem install debugfile
Usage
require 'debugfile'
file = Debugfile.new('for_debug', 'foo.txt')
file.path #=> e.g.: "/tmp/for_debug/20140226/e34d7899-09cf-4b46-8ef4-4f751f9ae649-foo.txt"
file.write "hello!"
file.rewind
file.read #=> "hello!"
file.close
file = Debugfile.open('for_debug', 'foo.txt') {|f| f.write "Ruby!" }
file.open
file.read #=> "Ruby!"
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request