Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cch1/dimensional
Dimensional values (numbers with units of measure) can be parsed, stored, converted and formatted for output.
https://github.com/cch1/dimensional
Last synced: 25 days ago
JSON representation
Dimensional values (numbers with units of measure) can be parsed, stored, converted and formatted for output.
- Host: GitHub
- URL: https://github.com/cch1/dimensional
- Owner: cch1
- License: mit
- Created: 2009-10-16T19:55:57.000Z (about 15 years ago)
- Default Branch: master
- Last Pushed: 2010-02-17T21:19:32.000Z (almost 15 years ago)
- Last Synced: 2024-11-30T13:51:03.334Z (25 days ago)
- Language: Ruby
- Homepage:
- Size: 148 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
- Changelog: CHANGELOG
- License: LICENSE
Awesome Lists containing this project
README
# This library aims to provide effective parsing of user-supplied measures/metrics, intuitive scaling of those
# measures into a standard base scale unit and intuitive presentation of values. It does not attempt to mixin
# unit-oriented methods into Ruby standard classes -to perform operations, particularly across dimensions, you
# will need to use basic conversion methods provided by this library combined with standard Ruby numerical oper-
# ations. There is no method_missing magic or large mixin of spiffy unit-like methods here.
#
# Here are some examples of what you can do with the Dimensional library:
#
# require 'dimensional'
# require 'test/demo'
# class Autonomy < Dimensional::Metric
# self.dimension = Dimensional::Dimension::L
# end
# range = Autonomy.parse("15 nautical miles")
# range.to_s # => "15M"
# range.base # => >
# range.base.to_s # => "27780m"
# usrange = range.convert(Dimensional::Unit[:L, :US, :yd]) # => <30380.5774278215 >
#
# The demo library in the test directory contains a good starter set of units.
#
# The long-term objective for this library is to achieve compliance with the UCUM standard. References:
# UCUM Website: http://unitsofmeasure.org/
# UCUM Standard: http://aurora.regenstrief.org/~ucum/ucum.html