Class: Newshound::Exceptions::ExceptionTrack
- Inherits:
-
Base
- Object
- Base
- Newshound::Exceptions::ExceptionTrack
show all
- Defined in:
- lib/newshound/exceptions/exception_track.rb
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/newshound/exceptions/exception_track.rb', line 22
def format_for_banner(exception)
details = parse_exception_details(exception)
{
id: exception.try(:id),
title: details[:title],
message: details[:message].truncate(100),
location: details[:location],
time: exception.created_at.strftime("%I:%M %p")
}
end
|
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/newshound/exceptions/exception_track.rb', line 11
def format_for_report(exception, number)
details = parse_exception_details(exception)
<<~TEXT
*#{number}. #{details[:title]}*
• *Time:* #{exception.created_at.strftime("%I:%M %p")}
#{format_controller(details)}
#{format_message(details)}
TEXT
end
|
#recent(time_range:, limit:) ⇒ Object
4
5
6
7
8
9
|
# File 'lib/newshound/exceptions/exception_track.rb', line 4
def recent(time_range:, limit:)
::ExceptionTrack::Log
.where("created_at >= ?", time_range.ago)
.order(created_at: :desc)
.limit(limit)
end
|