github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

collectiveidea / measurement

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 15
    • 0
  • Source
  • Commits
  • Network (0)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (0)
Sending Request…
Click here to lend your support to: measurement and make a donation at www.pledgie.com ! Edit Pledgie Setup

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

A sweet Ruby measurement & converstion Library. — Read more

  cancel

http://daniel.collectiveidea.com/blog/2008/12/2/measurement-the-voodoo-library

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Added pending specs for farenheit 
brandon (author)
Mon Dec 01 20:26:29 -0800 2008
commit  ca48225a2f8cf11d72285033f23dc7a3d17268dd
tree    26a7206837951ea9649726a65395bc43f096e4ca
parent  acf8a8a4f26e0b125ab89782cf3ba3ff3aef7110
measurement /
name age
history
message
file History.txt Loading commit data...
file LICENSE
file Manifest.txt
file README.textile
file Rakefile
directory bin/
directory lib/
directory spec/
README.textile

measurement

A sweet Ruby measurement & converstion Library.

by Daniel Morrison, Collective Idea

Introduction

Measurement is a library I wrote ages ago, in large part to play with metaprogramming.

But its cool. All of the measurements and conversions are in yaml files, stored in lib/measurements. This lets me have fun with SI prefixes and such. Ideally these files would be a separate project, to be used by other languages, but that’s for another day.

What can it do?

Conversions.

<pre> > include Measurement::Length > Inch.new(12).to_centimeters => #<Measurement::Length::Centimeter:0x173c2b4 @units=30.48> </pre>

<pre> > include Measurement::Volume > Milliliter.new(100).to_teaspoons => #<Measurement::Volume::Teaspoon:0x1720e88 @units=45.0> </pre>

Check the yaml files to see what’s available, but note that SI prefixes (mega-, kilo-, yotta-, etc.) are applied magically, as are base2 prefixes for data.

What’s next?

Dunno, have ideas? Send me a message via github. I’m reviving the project after over a year, so its time to have some fun.

Some of my plans:

  • More units (please add!)
  • uh, tests.
  • Namespaced units (Volume::Beer::Barrel vs. Volume::Oil::Barrel)
  • Allow parents to be SI-derived (you can base a new unit on Meter, but not Kilometer)
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server