Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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