Class: Profiler::Collectors::DumpCollector
Instance Attribute Summary
#profile
Instance Method Summary
collapse
descendants, #has_data?, inherited, #initialize, #panel_content, #render_html, #render_mode, #subscribe
Instance Method Details
#collect ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/profiler/collectors/dump_collector.rb', line 32
def collect
dumps = Thread.current[:profiler_dumps] || []
formatted_dumps = dumps.map do |dump|
{
value: dump[:value],
formatted: format_value(dump[:value]),
file: dump[:file],
line: dump[:line],
label: dump[:label],
timestamp: dump[:timestamp]
}
end
store_data({
count: formatted_dumps.size,
dumps: formatted_dumps
})
Thread.current[:profiler_dumps] = []
end
|
#icon ⇒ Object
9
10
11
|
# File 'lib/profiler/collectors/dump_collector.rb', line 9
def icon
"🔍"
end
|
#name ⇒ Object
17
18
19
|
# File 'lib/profiler/collectors/dump_collector.rb', line 17
def name
"dump"
end
|
#priority ⇒ Object
13
14
15
|
# File 'lib/profiler/collectors/dump_collector.rb', line 13
def priority
15
end
|
#tab_config ⇒ Object
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/profiler/collectors/dump_collector.rb', line 21
def tab_config
{
key: "dump",
label: "Dumps",
icon: icon,
priority: priority,
enabled: true,
default_active: false
}
end
|
55
56
57
58
59
60
61
62
63
|
# File 'lib/profiler/collectors/dump_collector.rb', line 55
def toolbar_summary
count = @data[:count] || 0
color = count > 0 ? "blue" : "gray"
{
text: "#{count} dump#{count != 1 ? 's' : ''}",
color: color
}
end
|