Module: Faker::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}"]
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
))

Instance Method Summary collapse

Methods included from ModuleUtils

const_missing, k, underscore

Instance Method Details

#base_colorObject



15
16
17
# File 'lib/ffaker/vehicle.rb', line 15

def base_color
  Faker::Color.name
end

#drivetrainObject



19
20
21
# File 'lib/ffaker/vehicle.rb', line 19

def drivetrain
  DRIVETRAINS.sample
end

#makeObject



23
24
25
# File 'lib/ffaker/vehicle.rb', line 23

def make
  MAKES_LIST.sample
end

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



27
28
29
30
# File 'lib/ffaker/vehicle.rb', line 27

def manufacturer_color(n=2)
  # Take two prefixes because it's more fun than one
  [COLOR_PREFIXES.random_pick(n), self.base_color].flatten.join(' ')
end

#modelObject



33
34
35
# File 'lib/ffaker/vehicle.rb', line 33

def model
  MODELS_LIST.sample
end

#trimObject



37
38
39
# File 'lib/ffaker/vehicle.rb', line 37

def trim
  TRIMS_LIST.sample
end

#vinObject



41
42
43
# File 'lib/ffaker/vehicle.rb', line 41

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

#yearObject



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

def year
  YEARS.sample
end