Module: AirbrakeHelper
- Defined in:
- app/helpers/airbrake_helper.rb
Instance Method Summary collapse
-
#format_backtrace_element(element) ⇒ Object
Wiki markup for backtrace element with link to repository if possible.
-
#format_list_item(name, value) ⇒ Object
Wiki markup for a list item.
-
#format_table(data) ⇒ Object
Wiki markup for a table.
Instance Method Details
#format_backtrace_element(element) ⇒ Object
Wiki markup for backtrace element with link to repository if possible
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/helpers/airbrake_helper.rb', line 25 def format_backtrace_element(element) repository = repository_for_backtrace_element(element) if repository.blank? if element.line.blank? markup = "@#{element.file}@" else markup = "@#{element.file}:#{element.line}@" end else filename = filename_for_backtrace_element(element) if repository.identifier.blank? markup = "source:\"#{filename}#L#{element.line}\"" else markup = "source:\"#{repository.identifier}|#{filename}#L#{element.line}\"" end end markup + " in ??<notextile>#{element.function}</notextile>??" end |
#format_list_item(name, value) ⇒ Object
Wiki markup for a list item
18 19 20 21 22 |
# File 'app/helpers/airbrake_helper.rb', line 18 def format_list_item(name, value) return '' if value.blank? "* *#{name}:* #{value}" end |
#format_table(data) ⇒ Object
Wiki markup for a table
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'app/helpers/airbrake_helper.rb', line 3 def format_table(data) lines = [] data.each do |key, value| next if value.blank? if value.is_a?(String) lines << "|@#{key}@|@#{value}@|" elsif value.is_a?(Hash) lines << "|@#{key}@|@#{value.map { |k, v| "#{k}: #{v}"}.join(', ')}@|" end end lines.join("\n") end |