X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Fweather.rb;h=7c1336f0d017dfd62655bb2d4d859e7a563bd649;hb=8b811d21babf8f9e5a10a953b595d55ebd08820d;hp=36a5a88f4e78f4f15108c9bd1d32fd254e950214;hpb=e14bb61eeed956dda60f2e2ad3a3b9cc8667306a;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/weather.rb b/data/rbot/plugins/weather.rb index 36a5a88f..7c1336f0 100644 --- a/data/rbot/plugins/weather.rb +++ b/data/rbot/plugins/weather.rb @@ -15,15 +15,15 @@ require 'rexml/document' # Wraps NOAA National Weather Service information class CurrentConditions - @@bot = Irc::Utils.bot - def initialize(station) + def initialize(station, bot) @station = station + @bot = bot @url = "http://www.nws.noaa.gov/data/current_obs/#{URI.encode @station.upcase}.xml" @current_conditions = String.new end def update begin - resp = @@bot.httputil.get_response(@url) + resp = @bot.httputil.get_response(@url) case resp when Net::HTTPSuccess cc_doc = (REXML::Document.new resp.body).root @@ -161,7 +161,7 @@ class WeatherPlugin < Plugin if @nws_cache.has_key?(where) then met = @nws_cache[where] else - met = CurrentConditions.new(where) + met = CurrentConditions.new(where, @bot) end if met begin