Class: Profiler::Collectors::RoutesCollector
Instance Attribute Summary
#profile
Instance Method Summary
collapse
descendants, #has_data?, inherited, #initialize, #name, #panel_content, #render_html, #render_mode, #subscribe
Instance Method Details
#collect ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/profiler/collectors/routes_collector.rb', line 27
def collect
unless defined?(Rails) && Rails.respond_to?(:application) && Rails.application
return store_data({ routes: [], total: 0 })
end
matched_controller, matched_action = recognize_current_route
routes = build_routes_list(matched_controller, matched_action)
matched_route = routes.find { |r| r[:matched] }
store_data({
total: routes.size,
matched: matched_route,
routes: routes
})
end
|
#icon ⇒ Object
8
9
10
|
# File 'lib/profiler/collectors/routes_collector.rb', line 8
def icon
"🗺️"
end
|
#priority ⇒ Object
12
13
14
|
# File 'lib/profiler/collectors/routes_collector.rb', line 12
def priority
12
end
|
#tab_config ⇒ Object
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/profiler/collectors/routes_collector.rb', line 16
def tab_config
{
key: "routes",
label: "Routes",
icon: icon,
priority: priority,
enabled: true,
default_active: false
}
end
|
43
44
45
46
47
|
# File 'lib/profiler/collectors/routes_collector.rb', line 43
def toolbar_summary
data = panel_content
matched = data[:matched]
{ text: matched ? matched[:pattern] : "—", color: "blue" }
end
|