Sha256: a9ad4bb64f9ec8a2a25e16fd70e4e1a03af1703c20bd7377c63604805011e5a5

Contents?: true

Size: 499 Bytes

Versions: 2

Compression:

Stored size: 499 Bytes

Contents

require 'tmpdir'

class Report
  module Utils
    # stolen from https://github.com/seamusabshere/unix_utils
    def tmp_path(options = {})
      ancestor = [ self.class.name, options[:hint] ].compact.join('_')
      extname = options.fetch(:extname, '.tmp')
      basename = File.basename ancestor.sub(/^\d{9,}_/, '')
      basename.gsub! /\W/, '_'
      time = Time.now.strftime('%H%M%S%L')
      File.join Dir.tmpdir, [time, '_', basename[0..(234-extname.length)], extname].join
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
report-0.0.2 lib/report/utils.rb
report-0.0.1 lib/report/utils.rb