Class: Profiler::Collectors::BaseCollector
- Inherits:
-
Object
- Object
- Profiler::Collectors::BaseCollector
show all
- Defined in:
- lib/profiler/collectors/base_collector.rb
Direct Known Subclasses
AjaxCollector, CacheCollector, DatabaseCollector, DumpCollector, EnvCollector, ExceptionCollector, FlameGraphCollector, FunctionProfilerCollector, HttpCollector, I18nCollector, JobCollector, LogCollector, RequestCollector, RoutesCollector, ViewCollector
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of BaseCollector.
8
9
10
11
|
# File 'lib/profiler/collectors/base_collector.rb', line 8
def initialize(profile)
@profile = profile
@data = {}
end
|
Instance Attribute Details
#profile ⇒ Object
Returns the value of attribute profile.
6
7
8
|
# File 'lib/profiler/collectors/base_collector.rb', line 6
def profile
@profile
end
|
Class Method Details
.descendants ⇒ Object
80
81
82
|
# File 'lib/profiler/collectors/base_collector.rb', line 80
def self.descendants
@descendants || []
end
|
.inherited(subclass) ⇒ Object
74
75
76
77
78
|
# File 'lib/profiler/collectors/base_collector.rb', line 74
def self.inherited(subclass)
super
(@descendants ||= []) << subclass
end
|
Instance Method Details
#collect ⇒ Object
60
61
62
|
# File 'lib/profiler/collectors/base_collector.rb', line 60
def collect
end
|
#has_data? ⇒ Boolean
Whether this collector has data for the current profile
48
49
50
51
52
53
54
|
# File 'lib/profiler/collectors/base_collector.rb', line 48
def has_data?
data = panel_content
return false if data.nil?
return false if data.is_a?(Hash) && data.empty?
return false if data.is_a?(Array) && data.empty?
true
end
|
#icon ⇒ Object
17
18
19
|
# File 'lib/profiler/collectors/base_collector.rb', line 17
def icon
"📊"
end
|
#name ⇒ Object
13
14
15
|
# File 'lib/profiler/collectors/base_collector.rb', line 13
def name
self.class.name.split("::").last.gsub("Collector", "").downcase
end
|
#panel_content ⇒ Object
69
70
71
72
|
# File 'lib/profiler/collectors/base_collector.rb', line 69
def panel_content
@data
end
|
#priority ⇒ Object
21
22
23
|
# File 'lib/profiler/collectors/base_collector.rb', line 21
def priority
100
end
|
#render_html(profile) ⇒ Object
For custom HTML rendering from backend (when render_mode is :custom)
43
44
45
|
# File 'lib/profiler/collectors/base_collector.rb', line 43
def render_html(profile)
nil
end
|
#render_mode ⇒ Object
How to render the tab: :auto (use JSON), :custom (call render_html), :client (frontend renderer)
38
39
40
|
# File 'lib/profiler/collectors/base_collector.rb', line 38
def render_mode
:auto
end
|
#subscribe ⇒ Object
56
57
58
|
# File 'lib/profiler/collectors/base_collector.rb', line 56
def subscribe
end
|
#tab_config ⇒ Object
Tab configuration for dynamic tab system
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/profiler/collectors/base_collector.rb', line 26
def tab_config
{
key: name,
label: name.capitalize,
icon: icon,
priority: priority,
enabled: true,
default_active: false
}
end
|
64
65
66
67
|
# File 'lib/profiler/collectors/base_collector.rb', line 64
def toolbar_summary
""
end
|