Sha256: bbe2fa0c509ded0f80070b9f5627c5c78763eace81b2ecbd14dd511c295e0fa4

Contents?: true

Size: 617 Bytes

Versions: 1

Compression:

Stored size: 617 Bytes

Contents

# -*- coding: utf-8 -*-
module Cinch::Plugins
  class Weatherman
    class Weather
      attr_reader :location

      def initialize(location)
        @data       = WeatherUnderground::Base.new
                        .CurrentObservations(location)
        @location   = @data.display_location.first.full
        @temp       = @data.temp_f
        @conditions = @data.weather.downcase
        @updated    = Time.parse(@data.observation_time).ago.to_words
      end

      def to_s
        "In #{@location} it is #{@conditions} " +
        "and #{@temp}F (last updated about #{@updated})."
      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/weather.rb