Sha256: 9cae956e9cccd8a2a3ddca4ca1a6ec7056382a9250ad6a9aa5ebc131da2db226
Contents?: true
Size: 1.41 KB
Versions: 3
Compression:
Stored size: 1.41 KB
Contents
require 'date' module Barometer # # Forecast Measurement # a data class for forecasted weather conditions # # This is basically a data holding class for the forecasted weather # conditions. # class Measurement::Forecast < Measurement::Common attr_reader :date attr_reader :low, :high, :pop, :night # accessors (with input checking) # def date=(date) raise ArgumentError unless date.is_a?(Date) @date = date end def high=(high) raise ArgumentError unless high.is_a?(Data::Temperature) @high = high end def low=(low) raise ArgumentError unless low.is_a?(Data::Temperature) @low = low end def pop=(pop) raise ArgumentError unless pop.is_a?(Fixnum) @pop = pop end def night=(night) raise ArgumentError unless night.is_a?(Measurement::ForecastNight) @night = night end # # answer simple questions # def wet?(wet_icons=nil, pop_threshold=50, humidity_threshold=99) result = nil result ||= _wet_by_pop?(pop_threshold) if pop? result ||= super(wet_icons, humidity_threshold) if (icon? || humidity?) result end private def _wet_by_pop?(threshold=50) raise ArgumentError unless (threshold.is_a?(Fixnum) || threshold.is_a?(Float)) return nil unless pop? pop.to_f >= threshold.to_f end end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
attack-barometer-0.6.0 | lib/barometer/measurements/forecast.rb |
attack-barometer-0.6.1 | lib/barometer/measurements/forecast.rb |
barometer-0.6.1 | lib/barometer/measurements/forecast.rb |