enum RemiMath::Conv::Unit

Overview

A unit of measurement.

Defined in:

remilib/math/conversions.cr

Enum Members

Inches = 0

Distance

Feet = 1
Picometers = 2
Nanometers = 3
Micrometers = 4
Millimeters = 5
Centimeters = 6
Miles = 7
NauticalMiles = 8
Kilometers = 9
Parsecs = 10
Lightyears = 11
MilesPerHour = 12

Speed

KilometersPerHour = 13
Knots = 14
Kilograms = 15

Mass/Weight

Pounds = 16
Celsius = 17

Temperature

Fahrenheit = 18
Kelvin = 19
Rankine = 20
Degrees = 21

Angle/Circle stuff

Radians = 22
Liters = 23

Liquids

UsGallons = 24
UsPints = 25

Class Method Summary

Instance Method Summary

Class Method Detail

def self.parseUnit?(name : String) : Unit | Nil #

Similar to Unit.parse?, except that this also understands abbreviations and alternate spellings.


[View source]

Instance Method Detail

def abbrev : String #

Returns the abbreviation for this Unit.


[View source]
def celsius? #

[View source]
def centimeters? #

[View source]
def conv(other : Unit, value) : BigDecimal | Nil #

Attempts to convert self to a new Unit value, returned as a BigDecimal. If the conversion cannot happen, this returns nil.


[View source]
def degrees? #

[View source]
def fahrenheit? #

[View source]
def fancyName : String #

Returns the "fancy name" for this Unit. This is a bit different than #to_s and Unit.names in that it is downcase and may be an alternate name (e.g. Unit::UsPints = "pints").

The name returned here can be re-parsed using Unit.parseUnit?.


[View source]
def feet? #

[View source]
def inches? #

[View source]
def kelvin? #

[View source]
def kilograms? #

[View source]
def kilometers? #

[View source]
def kilometers_per_hour? #

[View source]
def knots? #

[View source]
def lightyears? #

[View source]
def liters? #

[View source]
def micrometers? #

[View source]
def miles? #

[View source]
def miles_per_hour? #

[View source]
def millimeters? #

[View source]
def nanometers? #

[View source]
def nautical_miles? #

[View source]
def parsecs? #

[View source]
def picometers? #

[View source]
def pounds? #

[View source]
def radians? #

[View source]
def rankine? #

[View source]
def us_gallons? #

[View source]
def us_pints? #

[View source]