Module: Unite::Dimension

Extended by:
Dimension
Included in:
Dimension
Defined in:
lib/unite/dimension.rb,
lib/unite/dimension/vector.rb,
lib/unite/dimension/integer.rb

Defined Under Namespace

Modules: Integer, Vector

Constant Summary collapse

VECTOR_LIST =

0 length meter 1 time second 2 temperature kelvin 3 mass kilogram 4 current ampere 5 substance mole 6 luminosity candela

[:length, :time, :temperature, :mass, :current, :substance, :luminosity]
DIMSIZES =
[20, 20, 20, 10, 10, 10, 10]
DIMVALS =
[1, 20, 400, 8000, 80000, 800000, 8000000]
LIST =

also include the dimensionless dimension “none”

VECTOR_LIST + [:none]
UNITS =
['km', 's', 'K', 'kg', 'A', 'mol', 'cd', '']
INDICIES =

Instance Method Summary collapse

Instance Method Details

#blank_dimension_vectorObject



37
38
39
# File 'lib/unite/dimension.rb', line 37

def blank_dimension_vector
  Array.new(VECTOR_LIST.length, 0)
end

#si_unit(dimension_name_or_index) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/unite/dimension.rb', line 29

def si_unit dimension_name_or_index
  if dimension_name_or_index.kind_of? Fixnum
    UNITS[dimension_name_or_index]
  else
    UNITS[INDICIES[dimension_name_or_index.to_sym]]
  end
end