Sha256: 894258ade116ccc805e8cef923f9abe27d2782c74a600709a9cf7d64f3b66117
Contents?: true
Size: 578 Bytes
Versions: 6
Compression:
Stored size: 578 Bytes
Contents
require 'tmpdir' class TraceTree class TmpFile DefaultName = 'trace_tree.html' def initialize path @tmp = Dir.tmpdir path = DefaultName if path == true @tmp = custom path end def puts *content File.open @tmp, 'a' do |f| f.puts *content end end def path @tmp end private def custom path path = Array(path).map(&:to_s) path[-1] = time + path[-1] path = [@tmp] + path File.join *path end def time Time.now.strftime '%Y%m%d_%H%M%S_%L_' end end end
Version data entries
6 entries across 6 versions & 1 rubygems