module RaspbergUptimeReport
RaspbergUptimeReport — IRC cards for uptime replies.
Constants
- SOURCE
- TAG
Public Instance Methods
Source
# File lib/raspberg_uptime_report.rb, line 14 def format_current(minutes:) IrcReply.card( tag: TAG, title: "Up Time", body_lines: [RaspbergUptime.format_minutes_vb(minutes)], footer_parts: [SOURCE] ) end
Source
# File lib/raspberg_uptime_report.rb, line 23 def format_stats(stats:, current_minutes:) average = if stats["reboot_count"].to_i.positive? (stats["total_minutes"].to_f + current_minutes) / (stats["reboot_count"].to_i + 1) else current_minutes end body_lines = [ RaspbergUptime.format_labeled_minutes("Highest: ", stats["highest_minutes"]), RaspbergUptime.format_labeled_minutes("Last: ", stats["last_session_minutes"]), RaspbergUptime.format_labeled_minutes("Total: ", stats["total_minutes"].to_f + current_minutes), RaspbergUptime.format_labeled_minutes("Average: ", average), "Reboots: #{stats['reboot_count']}" ] IrcReply.card( tag: TAG, title: "Up Time Stats", body_lines: body_lines, footer_parts: [SOURCE] ) end