Sha256: 8f3ad03368b99207028c1c0609ff0f6c992087d759015740ab2f732d3c267bad

Contents?: true

Size: 1.37 KB

Versions: 4

Compression:

Stored size: 1.37 KB

Contents

module Accuweather
  module Conditions
    class Local
      attr_reader :city, :state, :latitude, :longitude, :time, :time_zone, :obs_daylight, :current_gmt_offset, :time_zone_abbreviation

      def initialize(city:, state:, latitude:, longitude:, time:, time_zone:, obs_daylight:, current_gmt_offset:, time_zone_abbreviation:)
        @city = city
        @state = state
        @latitude = latitude
        @longitude = longitude
        @time = time
        @time_zone = time_zone
        @obs_daylight = obs_daylight
        @current_gmt_offset = current_gmt_offset
        @time_zone_abbreviation = time_zone_abbreviation
      end

      def ==(other)
        city == other.city &&
          state == other.state &&
          latitude == other.latitude &&
          longitude == other.longitude &&
          time == other.time &&
          time_zone == other.time_zone &&
          obs_daylight == other.obs_daylight &&
          current_gmt_offset == other.current_gmt_offset &&
          time_zone_abbreviation == other.time_zone_abbreviation
      rescue NoMethodError
        false
      end

      def to_s
        "city: #{city}, state: #{state}, latitude: #{latitude}, longitude: #{longitude}, time: #{time}, time_zone: #{time_zone}, obs_daylight: #{obs_daylight}, current_gmt_offset: #{current_gmt_offset}, time_zone_abbreviation: #{time_zone_abbreviation}"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
accuweather-0.2.3 lib/accuweather/conditions/local.rb
accuweather-0.2.2 lib/accuweather/conditions/local.rb
accuweather-0.2.0 lib/accuweather/conditions/local.rb
accuweather-0.1.3 lib/accuweather/conditions/local.rb