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)
YEARS =
[*'1900'..(Date.today.year + 1).to_s]
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)
CYLINDERS =
%w(2 5 6 8)

Instance Method Summary collapse

Methods included from ModuleUtils

const_missing, k, underscore

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
  DRIVETRAINS.sample
end

#engine_cylindersObject



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

def engine_cylinders
  CYLINDERS.sample
end

#engine_displacementObject



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

def engine_displacement
  DISPLACEMENTS_LIST.sample
end

#fuel_typeObject



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

def fuel_type
  FUEL_TYPES_LIST.sample
end

#interior_upholsteryObject



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

def interior_upholstery
  UPHOLSTERY_LIST.sample
end

#makeObject



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

def make
  MAKES_LIST.sample
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
  (COLOR_PREFIXES.sample(n) + [base_color]).join(' ')
end

#modelObject



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

def model
  MODELS_LIST.sample
end

#transmissionObject



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

def transmission
  TRANSMISSIONS_LIST.sample
end

#transmission_abbrObject



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

def transmission_abbr
  TRANSMISSIONS_ABBR.sample
end

#trimObject



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

def trim
  TRIMS_LIST.sample
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
  YEARS.sample
end