Sha256: 6749c4119aa45b10582c08bd396f7a55a707465e19633ead8f5daefed8b967cc

Contents?: true

Size: 285 Bytes

Versions: 15

Compression:

Stored size: 285 Bytes

Contents

# frozen_string_literal: true

module Entangler
  module Helper
    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
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
entangler-1.6.1 lib/entangler/executor/helpers.rb
entangler-1.6.0 lib/entangler/executor/helpers.rb
entangler-1.5.1 lib/entangler/executor/helpers.rb
entangler-1.5.0 lib/entangler/executor/helpers.rb
entangler-1.4.1 lib/entangler/executor/helpers.rb
entangler-1.4.0 lib/entangler/executor/helpers.rb
entangler-1.3.3 lib/entangler/executor/helpers.rb
entangler-1.3.2 lib/entangler/executor/helpers.rb
entangler-1.3.1 lib/entangler/executor/helpers.rb
entangler-1.3.0 lib/entangler/executor/helpers.rb
entangler-1.2.3 lib/entangler/executor/helpers.rb
entangler-1.2.2 lib/entangler/executor/helpers.rb
entangler-1.2.1 lib/entangler/executor/helpers.rb
entangler-1.2.0 lib/entangler/executor/helpers.rb
entangler-1.1.2 lib/entangler/executor/helpers.rb