Class: Okei::Unit
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Okei::Unit
- Includes:
- Uuids::Base
- Defined in:
- app/models/okei/unit.rb
Overview
Stores and validates units of measure.
Attributes:
uuids
-
list of Units::Uuid objects assigned (referred to) the unit.
code
-
literal cyrillic code (“КМ/Ч”).
name
-
name of the unit (“Километры в час”).
num
-
numeric code of the unit following the OKEI (“007”).
int_code
-
a literal international code of the unit (“KMH”).
base
-
literal cyrillic code of the basic unit of measure (“М/С”).
factor
-
float number of basic units in a current unit (0.28).
measure
-
the name of measurement (“СКОРОСТЬ”) used for filtering units.
Methods:
#uuid
-
returns value of the first
uuids
assigned to the unit. .by_uuid(value)
-
selects units by a given UUID.
The first UUID can be set manually if necessary (when db populated from the outer list). Otherwise it will be assigned by default on the unit creation.
Constant Summary collapse
- NUM_FORMAT =
Format of OKEI numeric codes (three digits).
/\A\d{3}\z/