Class Eymiha::Units
In: lib/eymiha/units/units.rb
Parent: Object

The Units framework

Units is the top level that you‘ll typically never have to deal with directly. While it provides a few chunks of general functionality such as getting defined units and ranking, most of its guts are devoted to defining new UnitsMeasures - unless you‘re setting up your own sets of specialized units, you will hardly know it‘s here.

Methods

[]   clear   create   debug=   defining?   delete   derive   find_by_derivation   lookup   names_of   rank   size   units_measures  

Public Class methods

Returns the named UnitsMeasure.

Clears the Units framework of all defined elements.

Creates or extends a UnitsMeasure.

Answers the question of whether a UnitsMeasure is being defined with the instance if true, or nil if false.

Removes the named UnitsMeasure from the Units framework.

Creates or extends a UnitsMeasure derived from other UnitsMeasures.

Returns the UnitsMeasure with the given derivation.

Returns an Array of UnitsUnit associated with a singular, plural or abbreviated name.

Returns an Array containing the names of a given UnitsMeasure.

Given a Hash of units to raking weights, a set of samples, and optionally a block that returns rankings, returns an Array of units ordered by best weighted fit over the samples. Like golf, low scores rank best. In absence of a block, ranking is based on the number of unit values whose magnitudes are between 1 and 10.

Returns the number of defined UnitsMeasures.

Returns an Array of the defined UnitsMeasures.

[Validate]