enum

Unit::Density::Unit

Inherits Enum < Comparable < Value < Object

Density unit enumeration

Represents all supported density units. Each unit has:

  • A conversion factor to grams per milliliter (the base unit)
  • Methods to check unit system (metric/imperial)
  • Symbol and name representations
  • Aliases for common abbreviations

Usage

Unit::Density::Unit::GramPerMilliliter # Full enum reference
:gram_per_milliliter                   # Symbol shorthand in constructors
Unit::Density::Unit::GPerMl            # Alias

Constants

GramPerMilliliter = 0

Metric units

KilogramPerLiter = 1
GramPerCubicCentimeter = 2
KilogramPerCubicMeter = 3
PoundPerGallon = 4

Imperial units

PoundPerCubicFoot = 5
OuncePerCubicInch = 6
GPerMl = 0

Common aliases for convenience

KgPerL = 1
GPerCc = 2
KgPerM3 = 3
LbPerGal = 4
LbPerFt3 = 5
OzPerIn3 = 6
GPerMl2 = 0

Additional common abbreviations

GPerCm3 = 2

Instance methods

g_per_cc?

Returns true if this enum value equals GPerCc

Source
g_per_cm3?

Returns true if this enum value equals GPerCm3

Source
g_per_ml2?

Returns true if this enum value equals GPerMl2

Source
g_per_ml?

Returns true if this enum value equals GPerMl

Source
gram_per_cubic_centimeter?

Returns true if this enum value equals GramPerCubicCentimeter

Source
gram_per_milliliter?

Returns true if this enum value equals GramPerMilliliter

Source
imperial?

Returns true if this unit is part of the imperial system

Source
kg_per_l?

Returns true if this enum value equals KgPerL

Source
kg_per_m3?

Returns true if this enum value equals KgPerM3

Source
kilogram_per_cubic_meter?

Returns true if this enum value equals KilogramPerCubicMeter

Source
kilogram_per_liter?

Returns true if this enum value equals KilogramPerLiter

Source
lb_per_ft3?

Returns true if this enum value equals LbPerFt3

Source
lb_per_gal?

Returns true if this enum value equals LbPerGal

Source
metric?

Returns true if this unit is part of the metric system

Source
name(plural = false)

Returns the full name with proper pluralization

Source
ounce_per_cubic_inch?

Returns true if this enum value equals OuncePerCubicInch

Source
oz_per_in3?

Returns true if this enum value equals OzPerIn3

Source
pound_per_cubic_foot?

Returns true if this enum value equals PoundPerCubicFoot

Source
pound_per_gallon?

Returns true if this enum value equals PoundPerGallon

Source
symbol

Returns the standard symbol for this unit

Source