Sha256: a799777f338c0fa42d9c71915e45360008bc1bf3ad27f5df15fb5795bb8f8244

Contents?: true

Size: 699 Bytes

Versions: 1

Compression:

Stored size: 699 Bytes

Contents

# -*- coding: utf-8 -*-
module Cinch::Plugins
  class Weatherman
    class Forecast
      def initialize(location)
        @data       = WeatherUnderground::Base.new
                        .SimpleForecast(location).days[1]
        fail ArgumentError if @data.nil?
        @location   = Weather.new(location).location
        @forecast   = @data.conditions.downcase
        @temp_high  = @data.high.fahrenheit.round
        @temp_low   = @data.low.fahrenheit.round
      end

      def to_s
        "Tommorrow in #{@location}; #{@forecast}, " +
        "high of #{@temp_high}F, low of #{@temp_low}F."
      end

      def append
        to_s.gsub(" in #{@location}", '')
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cinch-weatherman-1.0.4 lib/cinch/plugins/weatherman/forecast.rb