Sha256: b9c3362dad0119166cee1e82a4d798477c20fbc621c37d0069505d719a03a762

Contents?: true

Size: 619 Bytes

Versions: 2

Compression:

Stored size: 619 Bytes

Contents

require 'chemistry/temperature/unit'
require 'chemistry/temperature/kelvin'
require 'chemistry/temperature/fahrenheit'

module Chemistry
  module Temperature
    class Celsius < Chemistry::Temperature::Unit
      def to_celsius
        self
      end

      def to_kelvin
        Chemistry::Temperature::Kelvin.new convert_to_kelvin
      end

      def convert_to_kelvin
        @temperature + 273.15
      end

      def to_fahrenheit
        Chemistry::Temperature::Fahrenheit.new convert_to_fahrenheit
      end

      def convert_to_fahrenheit
        (@temperature * (9.0/5.0)) + 32.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/celsius.rb
chemistry-temperature-1.0.0 lib/chemistry/temperature/celsius.rb