temperature

What

Temperature makes it easy to deal with temperatures in Ruby, but
adding mixin methods to numbers and strings.

This was inspired by using Ruby to manipulate data from my home
weather station, and wanting it to keep track of the units for me so
that I didn’t have to think about that in code.

Installing

sudo gem install temperature

Demonstration of usage

freezing_in_F = 32
freezing_in_C = freezing_in_F.to_C

boiling_in_C = 100
boiling_in_C.units = "C"
boiling_in_F = boiling_in_C.to_F

absolute_zero = "0K".to_degrees
absolute_zero_in_C = absolute_zero.to_C
absolute_zero_in_F = absolute_zero.to_F

There is also support to calculate dewpoint from relative humidity
based on the NOAA approximation documented here -
http://en.wikipedia.org/wiki/Dew_point#Closer_approximation

dewpoint = 32.dewpoint(45)

API Documentation

Full module level documentation can be found at http://sdaguegems.rubyforge.org/temperature/rdoc

How to submit patches

Read the 8 steps for fixing other people’scode.

Fork the code on github, then send me a merge request.

git clone git://github.com/sdague/temperature.git

Build and test instructions

cd temperature
rake test
rake install_gem

License

This code is free to use under the terms of the MIT license.

Contact

Comments are welcome. Contact me via
github, or via my website

Sean Dague, 14th March 2010
Theme extended from Paul Battley