class Postdoc::HTMLDocument

Attributes

file[RW]

Public Class Methods

new(content, path: nil) click to toggle source
# File lib/postdoc/html_document.rb, line 11
def initialize(content, path: nil)
  path ||= Rails.root&.join('tmp') || '/tmp'
  @file = Tempfile.new ['input', '.html'], path

  file.write content
  file.flush
end

Public Instance Methods

cleanup() click to toggle source
# File lib/postdoc/html_document.rb, line 19
def cleanup
  file.close
  file.unlink
end