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 =
Array('1900'..(::Time.now.year + 1).to_s).freeze
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


13
14
15
# File 'lib/ffaker/vehicle.rb', line 13

def base_color
  FFaker::Color.name
end

#drivetrainObject


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

def drivetrain
  fetch_sample(DRIVETRAINS)
end

#engine_cylindersObject


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

def engine_cylinders
  fetch_sample(CYLINDERS)
end

#engine_displacementObject


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

def engine_displacement
  fetch_sample(DISPLACEMENTS_LIST)
end

#fuel_typeObject


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

def fuel_type
  fetch_sample(FUEL_TYPES_LIST)
end

#interior_upholsteryObject


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

def interior_upholstery
  fetch_sample(UPHOLSTERY_LIST)
end

#makeObject


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

def make
  fetch_sample(MAKES_LIST)
end

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


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

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

#modelObject


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

def model
  fetch_sample(MODELS_LIST)
end

#transmissionObject


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

def transmission
  fetch_sample(TRANSMISSIONS_LIST)
end

#transmission_abbrObject


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

def transmission_abbr
  fetch_sample(TRANSMISSIONS_ABBR)
end

#trimObject


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

def trim
  fetch_sample(TRIMS_LIST)
end

#vinObject


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

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

#yearObject


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

def year
  fetch_sample(YEARS)
end