Sha256: 8fdba23976eb9c2ff30ac54df01b1b4d9f6a99d01fd15ec644aae985d7a3a5df

Contents?: true

Size: 426 Bytes

Versions: 8

Compression:

Stored size: 426 Bytes

Contents

module Barometer
  module Data
    class Temperature < ConvertableUnits
      def c; metric; end
      def f; imperial; end

      def units
        metric? ? 'C' : 'F'
      end

      private

      def convert_imperial_to_metric(imperial_value)
        (5.0/9.0)*(imperial_value.to_f-32.0)
      end

      def convert_metric_to_imperial(metric_value)
        ((9.0/5.0)*metric_value.to_f)+32.0
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
barometer-0.9.7 lib/barometer/data/temperature.rb
barometer-0.9.6 lib/barometer/data/temperature.rb
barometer-0.9.5 lib/barometer/data/temperature.rb
barometer-0.9.4 lib/barometer/data/temperature.rb
barometer-0.9.3 lib/barometer/data/temperature.rb
barometer-0.9.2 lib/barometer/data/temperature.rb
barometer-0.9.1 lib/barometer/data/temperature.rb
barometer-0.9.0 lib/barometer/data/temperature.rb