Module: Faker::Vehicle
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
const_missing, k, underscore
Instance Method Details
#base_color ⇒ Object
15
16
17
|
# File 'lib/ffaker/vehicle.rb', line 15
def base_color
Faker::Color.name
end
|
#drivetrain ⇒ Object
19
20
21
|
# File 'lib/ffaker/vehicle.rb', line 19
def drivetrain
DRIVETRAINS.sample
end
|
#make ⇒ Object
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)
[COLOR_PREFIXES.random_pick(n), self.base_color].flatten.join(' ')
end
|
#model ⇒ Object
33
34
35
|
# File 'lib/ffaker/vehicle.rb', line 33
def model
MODELS_LIST.sample
end
|
#trim ⇒ Object
37
38
39
|
# File 'lib/ffaker/vehicle.rb', line 37
def trim
TRIMS_LIST.sample
end
|
#vin ⇒ Object
41
42
43
|
# File 'lib/ffaker/vehicle.rb', line 41
def vin
Faker.bothify('1#???#####?######').upcase
end
|
#year ⇒ Object
45
46
47
|
# File 'lib/ffaker/vehicle.rb', line 45
def year
YEARS.sample
end
|