Class: Octodown::Support::PersistentTempfile
- Inherits:
-
Tempfile
- Object
- Tempfile
- Octodown::Support::PersistentTempfile
- Defined in:
- lib/octodown/support/persistent_tempfile.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.create(content, ext) ⇒ Object
9 10 11 12 |
# File 'lib/octodown/support/persistent_tempfile.rb', line 9 def self.create(content, ext) document = new ['octodown', ".#{ext}"] document.persistent_write content end |
Instance Method Details
#persist ⇒ Object
14 15 16 17 |
# File 'lib/octodown/support/persistent_tempfile.rb', line 14 def persist ObjectSpace.undefine_finalizer self self end |
#persistent_write(content) ⇒ Object
19 20 21 22 23 |
# File 'lib/octodown/support/persistent_tempfile.rb', line 19 def persistent_write(content) write content close persist end |