Class: StackTrace::Viz::HTML
- Inherits:
-
Object
- Object
- StackTrace::Viz::HTML
- Defined in:
- lib/stack_trace/viz/html.rb
Constant Summary collapse
- LAYOUT_FILE =
"../../public/main.html.erb"- MAX_WRITE_BYTES =
64- MAX_JSON_NESTING =
1_000
Instance Method Summary collapse
- #add(trace, **extra) ⇒ Object
-
#initialize ⇒ HTML
constructor
A new instance of HTML.
- #save(file_path) ⇒ Object
Constructor Details
#initialize ⇒ HTML
Returns a new instance of HTML.
15 16 17 |
# File 'lib/stack_trace/viz/html.rb', line 15 def initialize @traces = [] end |
Instance Method Details
#add(trace, **extra) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/stack_trace/viz/html.rb', line 29 def add(trace, **extra) traces << { description: "Generated by StackTrace::Viz", **extra, trace: trace } end |
#save(file_path) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/stack_trace/viz/html.rb', line 19 def save(file_path) file_path ||= default_file_path File.open(file_path, "w") do |f| content_io.each_line(MAX_WRITE_BYTES) { |chunk| f.write(chunk) } end file_path end |