Module: FFaker::Vehicle

Extended by:
ModuleUtils, Vehicle
Included in:
Vehicle
Defined in:
lib/ffaker/vehicle.rb

Constant Summary collapse

DRIVETRAINS =
%w[4WD 4X4 AWD FWD RWD].freeze
YEARS =
[*'1900'..(Date.today.year + 1).to_s].freeze
COLOR_PREFIXES =
k(%w[
  beautiful bright calm dangerous dark dull fast magnetic magnificent majestic melodic metallic
  mundane mute mysterious new pleasant pretty resonant royal slate soft tranquil vibrant weak
])
TRANSMISSIONS_ABBR =
%w[AT MT AM CVT].freeze
CYLINDERS =
%w[2 5 6 8].freeze

Instance Method Summary collapse

Methods included from ModuleUtils

const_missing, k, underscore, unique

Methods included from RandomUtils

#fetch_sample, #rand, #shuffle

Instance Method Details

#base_colorObject


17
18
19
# File 'lib/ffaker/vehicle.rb', line 17

def base_color
  FFaker::Color.name
end

#drivetrainObject


21
22
23
# File 'lib/ffaker/vehicle.rb', line 21

def drivetrain
  fetch_sample(DRIVETRAINS)
end

#engine_cylindersObject


59
60
61
# File 'lib/ffaker/vehicle.rb', line 59

def engine_cylinders
  fetch_sample(CYLINDERS)
end

#engine_displacementObject


63
64
65
# File 'lib/ffaker/vehicle.rb', line 63

def engine_displacement
  fetch_sample(DISPLACEMENTS_LIST)
end

#fuel_typeObject


67
68
69
# File 'lib/ffaker/vehicle.rb', line 67

def fuel_type
  fetch_sample(FUEL_TYPES_LIST)
end

#interior_upholsteryObject


71
72
73
# File 'lib/ffaker/vehicle.rb', line 71

def interior_upholstery
  fetch_sample(UPHOLSTERY_LIST)
end

#makeObject


25
26
27
# File 'lib/ffaker/vehicle.rb', line 25

def make
  fetch_sample(MAKES_LIST)
end

#manufacturer_color(n = 2) ⇒ Object Also known as: mfg_color


29
30
31
32
# File 'lib/ffaker/vehicle.rb', line 29

def manufacturer_color(n = 2)
  # Take two prefixes because it's more fun than one
  (fetch_sample(COLOR_PREFIXES, count: n) + [base_color]).join(' ')
end

#modelObject


35
36
37
# File 'lib/ffaker/vehicle.rb', line 35

def model
  fetch_sample(MODELS_LIST)
end

#transmissionObject


51
52
53
# File 'lib/ffaker/vehicle.rb', line 51

def transmission
  fetch_sample(TRANSMISSIONS_LIST)
end

#transmission_abbrObject


55
56
57
# File 'lib/ffaker/vehicle.rb', line 55

def transmission_abbr
  fetch_sample(TRANSMISSIONS_ABBR)
end

#trimObject


39
40
41
# File 'lib/ffaker/vehicle.rb', line 39

def trim
  fetch_sample(TRIMS_LIST)
end

#vinObject


43
44
45
# File 'lib/ffaker/vehicle.rb', line 43

def vin
  FFaker.bothify('1#???#####?######').upcase
end

#yearObject


47
48
49
# File 'lib/ffaker/vehicle.rb', line 47

def year
  fetch_sample(YEARS)
end