Sha256: 3bcbe76dec3808618d7f43b167ee1bb928fcb36840f948905b475582c6033437
Contents?: true
Size: 864 Bytes
Versions: 1
Compression:
Stored size: 864 Bytes
Contents
require "adc/version" require "nokogiri" require "open-uri" require "colorize" module Adc def self.pull_statuses current = {} online = {} offline = {} doc = Nokogiri::HTML(open("https://developer.apple.com/support/system-status/")) statuses = doc.css('table.status-table td') statuses.each do |ret_stat| status = ret_stat.attributes["class"].value name = ret_stat.children.last.to_s.gsub(/<\/?[^>]*>/, "") name.gsub!("&", "&") # omg haxxx current[name] = status end current.each do |k,v| if v == "online" online[k] = v elsif v == "offline" offline[k] = v end end puts "Online: ".green online.each do |k,v| puts "#{k}: #{v}".green end puts puts "Offline: ".red offline.each do |k,v| puts "#{k}: #{v}".red end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
adc-0.0.1 | lib/adc.rb |