Sha256: ea698ac9861232fd33b320afd60e31b505479206736ef07e2bec744dbde3dd46

Contents?: true

Size: 470 Bytes

Versions: 2

Compression:

Stored size: 470 Bytes

Contents

require 'chemistry/temperature/unit'
require 'chemistry/temperature/celsius'

module Chemistry
  module Temperature
    class Fahrenheit < Chemistry::Temperature::Unit
      def to_fahrenheit
        self
      end

      def to_kelvin
        to_celsius.to_kelvin
      end

      def to_celsius
        Chemistry::Temperature::Celsius.new convert_to_celsius
      end

      def convert_to_celsius
        (@temperature - 32.0) / (9.0/5.0)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
chemistry-temperature-1.0.1 lib/chemistry/temperature/fahrenheit.rb
chemistry-temperature-1.0.0 lib/chemistry/temperature/fahrenheit.rb