Sha256: 0bf1d122e56ab5586e761ddf724b2ad09b0956c413c29a159cd9e756dc52e44d

Contents?: true

Size: 786 Bytes

Versions: 2

Compression:

Stored size: 786 Bytes

Contents

module Weather
  class Units
    FAHRENHEIT = 'f'
    CELSIUS   = 'c'

    # the unit in which temperature is measured
    # e.g. F for Fahrenheit, and C for Celsius
    attr_reader :temperature

    # the unit in which distance is measured
    # e.g. mi for miles, and km for kilometers
    attr_reader :distance

    # the unit in which pressure is measured
    # e.g in for inches, and cm for centimeters
    attr_reader :pressure

    # the unit in which speed is measured
    # e.g. mph for miles per hour, and kph for kilometers per hour
    attr_reader :speed

    def initialize(payload)
      @temperature = payload[:temperature].strip
      @distance = payload[:distance].strip
      @pressure = payload[:pressure].strip
      @speed = payload[:speed].strip
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
weather-api-1.4.0 lib/weather-api/units.rb
weather-api-1.3.0 lib/weather-api/units.rb