Path: | lib/more/facets/multipliers.rb |
Last Update: | Tue Oct 28 06:39:06 -0400 2008 |
WARNING: Use Rich Units package for future compatibilty!
Adds methods to Numeric to make working with magnitudes (kilo, mega, giga, milli, micro, etc.) as well as bits and bytes easier.
1.kilo #=> 1000 1.milli #=> 0.001 1.kibi #=> 1024
To display a value in a certain denomination, simply perform the inverse operation by placing the multiplier called on unit (1) in the denominator.
1000 / 1.kilo #=> 1 1024 / 1.kibi #=> 1
Thanks to Rich Kilmer and bytes.rb which inspired this library.
Copyright (c) 2005 Thomas Sawyer
Ruby License
This module is free software. You may use, modify, and/or redistribute this software under the same terms as Ruby.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.