Created
October 8, 2009 21:30
-
-
Save jordandobson/205438 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'open-uri' | |
module SchoolReport | |
NO_ALERT = "0" | |
ALERT = /.+\w+\s+(\d)\s+\d+/ | |
URL = 'http://media.schoolreport.org/media/export.php?userId=422' | |
def self.has_alert? | |
open(URL) do |report| | |
report.each_line do |school| | |
school_has = school[ALERT,1] | |
unless school_has == NO_ALERT || school_has == nil | |
return true | |
break | |
end | |
end | |
end | |
false | |
end | |
end | |
puts SchoolReport.has_alert? | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment