Module: FFaker::UnitMetric

Extended by:
ModuleUtils, UnitMetric
Includes:
Unit
Included in:
UnitMetric
Defined in:
lib/ffaker/unit_metric.rb

Constant Summary collapse

LENGTH_UNITS =
[
  { name: 'millimeters', abbreviation: 'mm' },
  { name: 'centimeters', abbreviation: 'cm' },
  { name: 'meters', abbreviation: 'm' },
  { name: 'kilometers', abbreviation: 'km' }
].freeze
MASS_UNITS =
[
  { name: 'gram', abbreviation: 'g' },
  { name: 'kilogram', abbreviation: 'kg' },
  { name: 'metric ton', abbreviation: 'mt' }
].freeze
LIQUID_UNITS =
[
  { name: 'milliliters', abbreviation: 'ml' },
  { name: 'liters', abbreviation: 'L' }
].freeze
VOLUME_UNITS =
[
  { name: ' cubic centimeters', abbreviation: 'cm^3' },
  { name: 'cubic meters', abbreviation: 'm^3' }
].freeze
AREA_UNITS =
[
  { name: 'centimeters squared', abbreviation: 'cm^2' },
  { name: 'meters squared', abbreviation: 'm^2' },
  { name: 'hectares', abbreviation: 'ha' },
  { name: 'kilometers', abbreviation: 'km' }
].freeze

Constants included from Unit

FFaker::Unit::TEMPERATURE_UNITS, FFaker::Unit::TIME_UNITS

Instance Method Summary collapse

Methods included from ModuleUtils

const_missing, k, luhn_check, underscore, unique

Methods included from RandomUtils

#fetch_sample, #rand, #shuffle

Methods included from Unit

#temperature_abbr, #temperature_name, #time_abbr, #time_name

Instance Method Details

#area_abbrObject



72
73
74
# File 'lib/ffaker/unit_metric.rb', line 72

def area_abbr
  area[:abbreviation]
end

#area_nameObject



68
69
70
# File 'lib/ffaker/unit_metric.rb', line 68

def area_name
  area[:name]
end

#length_abbrObject



48
49
50
# File 'lib/ffaker/unit_metric.rb', line 48

def length_abbr
  length[:abbreviation]
end

#length_nameObject



44
45
46
# File 'lib/ffaker/unit_metric.rb', line 44

def length_name
  length[:name]
end

#liquid_abbrObject



56
57
58
# File 'lib/ffaker/unit_metric.rb', line 56

def liquid_abbr
  liquid[:abbreviation]
end

#liquid_nameObject



52
53
54
# File 'lib/ffaker/unit_metric.rb', line 52

def liquid_name
  liquid[:name]
end

#mass_abbrObject



40
41
42
# File 'lib/ffaker/unit_metric.rb', line 40

def mass_abbr
  mass[:abbreviation]
end

#mass_nameObject



36
37
38
# File 'lib/ffaker/unit_metric.rb', line 36

def mass_name
  mass[:name]
end

#volume_abbrObject



64
65
66
# File 'lib/ffaker/unit_metric.rb', line 64

def volume_abbr
  volume[:abbreviation]
end

#volume_nameObject



60
61
62
# File 'lib/ffaker/unit_metric.rb', line 60

def volume_name
  volume[:name]
end