class GHStatus::CMDHelper
Public Class Methods
help()
click to toggle source
# File lib/ghstatus/cmd_helper.rb, line 6 def help puts "GHStatus - a command line tool for quick checkup of GitHub's API status." puts "Available methods:" puts "\tghstatus help - shows this help message." puts "\tghstatus - shows the current API status." puts "\tghstatus last - shows the last API status as a human readable message." puts "\tghstatus recent - shows the last few API statuses as a human readable messages." end
print_last_message(message)
click to toggle source
# File lib/ghstatus/cmd_helper.rb, line 21 def print_last_message message title print_message message end
print_recent_messages(messages)
click to toggle source
# File lib/ghstatus/cmd_helper.rb, line 26 def print_recent_messages messages title messages.each do |msg| print_message msg puts "-" * 32 end end
print_status(status)
click to toggle source
# File lib/ghstatus/cmd_helper.rb, line 15 def print_status status title puts "Status: #{color(status.status.capitalize)}" puts "Updated on #{status.updated_on.strftime("%m-%d-%Y at %I:%M%p")}" end
Private Class Methods
color(string)
click to toggle source
# File lib/ghstatus/cmd_helper.rb, line 47 def color string if string == 'Good' Rainbow(string).green else Rainbow(string).yellow end end
print_message(message)
click to toggle source
# File lib/ghstatus/cmd_helper.rb, line 36 def print_message message puts "Status: #{color(message.status.capitalize)}" puts "Message: #{message.body}" puts "Created on #{message.created_on.strftime("%m-%d-%Y at %I:%M%p")}" end
title()
click to toggle source
# File lib/ghstatus/cmd_helper.rb, line 42 def title puts "[GitHub API Status]" puts "=" * 19 end