VanUnits
SI Units System for Ruby

Introduction

VanUnits provides a powerful SI units system which integrates directly into Ruby's method dispatch system. With it, one can quickly perform typed calculations and conversions.

Here are few simple examples:

      reqiure 'van/units'
      include Units

      1.mile.to(feet)
      1.acre.to(yd**2)
      1.acre.to(sq_yd)
      1.gallon.to(self.L)
      1.lb.to(kg)
      1.m.s.to(m.s)
      1.sq_mi.to(km**2)
      1.mile.to(km)
      1.usd.to(twd)
      1.bit/s + 8.bytes/s
    

Pretty scienterrific, yes?

Also included are real world contants in both 'cm kg s' and 'm kg s' formats. Some examples...

      require 'van/units/constants'

      Van::Units::Constants::MKS::SPEED_OF_LIGHT    #=> 2.99792458e8 m/s
      Van::Units::Constants::CGS::SPEED_OF_LIGHT    #=> 2.99792458e10 cm/s
    

Resources

NIST Reference Reference material for SI Constants, Units and Uncertianty.
MathWorld A free resource from Wolfram Research built on Mathematica technology.

Copying

VanUnits is copyrighted by Peter Vanbroekhoven. Some adapted works also have respective copyrights to their contributors.

VanUnits is distributed under the terms of the MIT license.




All ad revenues support RubyWorks, a collection of open source projects.