Sha256: a9409a0dcfee33126f5f8ec772b093bbd5bd74fc2c4e590cc2dd0cd2eb05330c

Contents?: true

Size: 881 Bytes

Versions: 3

Compression:

Stored size: 881 Bytes

Contents

module Accuweather
  module Conditions
    class ForecastDay
      attr_reader :date, :day_of_week, :sunrise, :sunset, :daytime, :nighttime

      def initialize(date:, day_of_week:, sunrise:, sunset:, daytime:, nighttime:)
        @date = date
        @day_of_week = day_of_week
        @sunrise = sunrise
        @sunset = sunset
        @daytime = daytime
        @nighttime = nighttime
      end

      def ==(other)
        date == other.date &&
          day_of_week == other.day_of_week &&
          sunrise == other.sunrise &&
          sunset == other.sunset &&
          daytime == other.daytime &&
          nighttime == other.nighttime
      rescue NoMethodError
        false
      end

      def to_s
        "date: #{date}, day_of_week: #{day_of_week}, sunrise: #{sunrise}, sunset: #{sunset}, daytime: #{daytime}, nighttime: #{nighttime}"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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