-
Notifications
You must be signed in to change notification settings - Fork 0
Dimensional values (numbers with units of measure) can be parsed, stored, converted and formatted for output.
License
cch1/Dimensional
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
# 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 # => <Rational(27780, 1) <meter>> # range.base.to_s # => "27780m" # usrange = range.convert(Dimensional::Unit[:L, :US, :yd]) # => <30380.5774278215 <yard>> # # 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: https://unitsofmeasure.org/ # UCUM Standard: https://aurora.regenstrief.org/~ucum/ucum.html
About
Dimensional values (numbers with units of measure) can be parsed, stored, converted and formatted for output.
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published