module Entangler::Helper

Public Class Methods

with_temp_file(name: 'tmp_file', contents: nil) { |t| ... } click to toggle source
# File lib/entangler/executor/helpers.rb, line 5
def self.with_temp_file(name: 'tmp_file', contents: nil)
  require 'tempfile'

  t = Tempfile.new(name)
  t.puts(contents) unless contents.nil?
  t.close
  yield t
  t.unlink
end