Module: RailsErrorDashboard::BacktraceHelper
- Defined in:
- app/helpers/rails_error_dashboard/backtrace_helper.rb
Instance Method Summary collapse
-
#filter_app_code(frames) ⇒ Object
Filter to show only application code.
-
#filter_framework_code(frames) ⇒ Object
Filter to show framework/gem code.
-
#frame_bg_class(category) ⇒ Object
Get background color class for frame Uses Catppuccin-themed backtrace frame classes from _components.scss.
-
#frame_category_name(category) ⇒ Object
Format category name.
-
#frame_color_class(category) ⇒ Object
Get color class for frame category.
-
#frame_count_by_category(frames) ⇒ Object
Count frames by category.
-
#frame_icon(category) ⇒ Object
Get icon for frame category.
-
#parse_backtrace(backtrace_string) ⇒ Object
Parse backtrace string into structured frames.
Instance Method Details
#filter_app_code(frames) ⇒ Object
Filter to show only application code
11 12 13 |
# File 'app/helpers/rails_error_dashboard/backtrace_helper.rb', line 11 def filter_app_code(frames) frames.select { |f| f[:category] == :app } end |
#filter_framework_code(frames) ⇒ Object
Filter to show framework/gem code
16 17 18 |
# File 'app/helpers/rails_error_dashboard/backtrace_helper.rb', line 16 def filter_framework_code(frames) frames.reject { |f| f[:category] == :app } end |
#frame_bg_class(category) ⇒ Object
Get background color class for frame Uses Catppuccin-themed backtrace frame classes from _components.scss
54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'app/helpers/rails_error_dashboard/backtrace_helper.rb', line 54 def frame_bg_class(category) case category when :app "backtrace-frame frame-app" when :gem "backtrace-frame frame-gem" when :framework "backtrace-frame frame-framework" when :ruby_core "backtrace-frame frame-ruby-core" else "" end end |
#frame_category_name(category) ⇒ Object
Format category name
70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'app/helpers/rails_error_dashboard/backtrace_helper.rb', line 70 def frame_category_name(category) case category when :app "Your Code" when :gem "Gem" when :framework "Rails Framework" when :ruby_core "Ruby Core" else "Unknown" end end |
#frame_color_class(category) ⇒ Object
Get color class for frame category
37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'app/helpers/rails_error_dashboard/backtrace_helper.rb', line 37 def frame_color_class(category) case category when :app "text-success fw-bold" when :gem "text-info" when :framework "text-warning" when :ruby_core "text-secondary" else "text-muted" end end |
#frame_count_by_category(frames) ⇒ Object
Count frames by category
86 87 88 89 |
# File 'app/helpers/rails_error_dashboard/backtrace_helper.rb', line 86 def frame_count_by_category(frames) frames.group_by { |f| f[:category] } .transform_values(&:count) end |
#frame_icon(category) ⇒ Object
Get icon for frame category
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/helpers/rails_error_dashboard/backtrace_helper.rb', line 21 def frame_icon(category) case category when :app '<i class="bi bi-code-square text-success"></i>'.html_safe when :gem '<i class="bi bi-box text-info"></i>'.html_safe when :framework '<i class="bi bi-gear text-warning"></i>'.html_safe when :ruby_core '<i class="bi bi-gem text-secondary"></i>'.html_safe else '<i class="bi bi-question-circle text-muted"></i>'.html_safe end end |
#parse_backtrace(backtrace_string) ⇒ Object
Parse backtrace string into structured frames
6 7 8 |
# File 'app/helpers/rails_error_dashboard/backtrace_helper.rb', line 6 def parse_backtrace(backtrace_string) Services::BacktraceParser.parse(backtrace_string) end |