Sha256: 9769b189559d421a4a108f839168dbd6f61f71acfcfd6277afe7560fb7cf9a9d
Contents?: true
Size: 578 Bytes
Versions: 1
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, 'w' 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
trace_tree-0.1.3 | lib/trace_tree/tmp_file.rb |