Class: TraceTree::TmpFile
- Inherits:
-
Object
- Object
- TraceTree::TmpFile
- Defined in:
- lib/trace_tree/tmp_file.rb
Constant Summary collapse
- DefaultName =
'trace_tree.html'
Instance Method Summary collapse
-
#initialize(path, transcode: false) ⇒ TmpFile
constructor
A new instance of TmpFile.
- #path ⇒ Object
- #puts(*content) ⇒ Object
Constructor Details
#initialize(path, transcode: false) ⇒ TmpFile
Returns a new instance of TmpFile.
15 16 17 18 19 |
# File 'lib/trace_tree/tmp_file.rb', line 15 def initialize path, transcode: false path = recognize_dir path @tmp = custom path @transcode = transcode end |
Instance Method Details
#path ⇒ Object
29 30 31 |
# File 'lib/trace_tree/tmp_file.rb', line 29 def path @tmp end |
#puts(*content) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/trace_tree/tmp_file.rb', line 21 def puts *content content = content.map{ |c| c.to_s.encode('UTF-8', invalid: :replace, undef: :replace, replace: '?') } if @transcode File.open @tmp, 'a' do |f| f.puts(*content) end end |