Sha256: 6990fd9535be699533af0974ee746cade5abe6ad9c27008c9cbe1fed3f4325ce
Contents?: true
Size: 401 Bytes
Versions: 9
Compression:
Stored size: 401 Bytes
Contents
# frozen_string_literal: true require 'rails' module Postdoc class HTMLDocument attr_accessor :file delegate :path, to: :file def initialize(content, path: nil) path ||= Rails.root&.join('tmp') || '/tmp' @file = Tempfile.new ['input', '.html'], path file.write content file.flush end def cleanup file.close file.unlink end end end
Version data entries
9 entries across 9 versions & 1 rubygems