Module: FFaker::UnitEnglish

Extended by:
ModuleUtils, UnitEnglish
Includes:
Unit
Included in:
UnitEnglish
Defined in:
lib/ffaker/unit_english.rb

Constant Summary collapse

LENGTH_UNITS =
[
  { name: 'inch', abbreviation: 'in' },
  { name: 'foot', abbreviation: 'ft' },
  { name: 'yard', abbreviation: 'yd' },
  { name: 'furlong', abbreviation: 'fur' },
  { name: 'mile', abbreviation: 'mi' }
].freeze
MASS_UNITS =
[
  { name: 'grains', abbreviation: 'gr' },
  { name: 'ounces', abbreviation: 'oz' },
  { name: 'pounds', abbreviation: 'lb' },
  { name: 'hundredweight', abbreviation: 'cwt' },
  { name: 'ton', abbreviation: 't' }
].freeze
LIQUID_UNITS =
[
  { name: 'fluid ounce', abbreviation: 'fl oz' },
  { name: 'gill', abbreviation: 'gi' },
  { name: 'pint', abbreviation: 'pt' },
  { name: 'quart', abbreviation: 'qt' }
].freeze
VOLUME_UNITS =
[
  { name: 'cubic inch', abbreviation: 'CI' },
  { name: 'cubic foot', abbreviation: 'CFT' },
  { name: 'cubic yard', abbreviation: 'CY' }
].freeze
AREA_UNITS =
[
  { name: 'square inch', abbreviation: 'sq in' },
  { name: 'square foot', abbreviation: 'sq ft' },
  { name: 'square yard', abbreviation: 'sq yd' },
  { name: 'acre', abbreviation: 'ac' },
  { name: 'section', abbreviation: 's' },
  { name: 'square mile', abbreviation: 'sq mi' },
  { name: 'township', abbreviation: 'twp' }
].freeze

Constants included from Unit

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

Instance Method Summary collapse

Methods included from ModuleUtils

const_missing, k, 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


81
82
83
# File 'lib/ffaker/unit_english.rb', line 81

def area_abbr
  area[:abbreviation]
end

#area_nameObject


77
78
79
# File 'lib/ffaker/unit_english.rb', line 77

def area_name
  area[:name]
end

#length_abbrObject


57
58
59
# File 'lib/ffaker/unit_english.rb', line 57

def length_abbr
  length[:abbreviation]
end

#length_nameObject


53
54
55
# File 'lib/ffaker/unit_english.rb', line 53

def length_name
  length[:name]
end

#liquid_abbrObject


65
66
67
# File 'lib/ffaker/unit_english.rb', line 65

def liquid_abbr
  liquid[:abbreviation]
end

#liquid_nameObject


61
62
63
# File 'lib/ffaker/unit_english.rb', line 61

def liquid_name
  liquid[:name]
end

#mass_abbrObject


49
50
51
# File 'lib/ffaker/unit_english.rb', line 49

def mass_abbr
  mass[:abbreviation]
end

#mass_nameObject


45
46
47
# File 'lib/ffaker/unit_english.rb', line 45

def mass_name
  mass[:name]
end

#volume_abbrObject


73
74
75
# File 'lib/ffaker/unit_english.rb', line 73

def volume_abbr
  volume[:abbreviation]
end

#volume_nameObject


69
70
71
# File 'lib/ffaker/unit_english.rb', line 69

def volume_name
  volume[:name]
end