@@ -16,7 +16,9 @@ defmodule Faker.Vehicle.En do
16
16
"Lincoln" ,
17
17
"Buick" ,
18
18
"Honda" ,
19
- "Nissan"
19
+ "Nissan" ,
20
+ "Mercedes-Benz" ,
21
+ "Aston Martin"
20
22
]
21
23
22
24
@ models % {
@@ -29,7 +31,9 @@ defmodule Faker.Vehicle.En do
29
31
"Lincoln" => [ "Navigator" , "MKZ" , "MKX" , "MKS" ] ,
30
32
"Buick" => [ "Enclave" , "Regal" , "LaCrosse" , "Verano" , "Encore" , "Riveria" ] ,
31
33
"Honda" => [ "Accord" , "Civic" , "CR-V" , "Odyssey" ] ,
32
- "Nissan" => [ "Rogue" , "Juke" , "Cube" , "Pathfiner" , "Versa" , "Altima" ]
34
+ "Nissan" => [ "Rogue" , "Juke" , "Cube" , "Pathfinder" , "Versa" , "Altima" ] ,
35
+ "Mercedes-Benz" => [ "AMG GLB 35" , "B-Class Electric Drive" , "G 550 4x4 Squared" ] ,
36
+ "Aston Martin" => [ "DB AR1 Zagato" , "DB7 Vantage" , "V8 Vantage S" ]
33
37
}
34
38
35
39
@ options [
@@ -262,8 +266,11 @@ defmodule Faker.Vehicle.En do
262
266
"Tire pressure monitoring display"
263
267
]
264
268
269
+ @ spec all_models :: [ String . t ( ) ]
265
270
defp all_models do
266
- Enum . reduce ( Map . values ( @ models ) , [ ] , fn models , acc -> acc ++ models end )
271
+ @ models
272
+ |> Map . values ( )
273
+ |> Enum . concat ( )
267
274
end
268
275
269
276
@ doc """
@@ -341,13 +348,13 @@ defmodule Faker.Vehicle.En do
341
348
## Examples
342
349
343
350
iex> Faker.Vehicle.En.make()
344
- "BMW"
345
- iex> Faker.Vehicle.En.make()
346
- "Audi"
351
+ "Lincoln"
347
352
iex> Faker.Vehicle.En.make()
348
353
"Dodge"
349
354
iex> Faker.Vehicle.En.make()
350
- "Ford"
355
+ "Chevy"
356
+ iex> Faker.Vehicle.En.make()
357
+ "Honda"
351
358
"""
352
359
@ spec make ( ) :: String . t ( )
353
360
def make do
@@ -360,18 +367,18 @@ defmodule Faker.Vehicle.En do
360
367
## Examples
361
368
362
369
iex> Faker.Vehicle.En.make_and_model()
363
- "BMW X5 "
370
+ "Lincoln MKZ "
364
371
iex> Faker.Vehicle.En.make_and_model()
365
- "Dodge Ram "
372
+ "Chevy Malibu "
366
373
iex> Faker.Vehicle.En.make_and_model()
367
- "Toyota Prius "
374
+ "Ford Focus "
368
375
iex> Faker.Vehicle.En.make_and_model()
369
376
"Ford Focus"
370
377
"""
371
378
@ spec make_and_model ( ) :: String . t ( )
372
379
def make_and_model do
373
- m = make ( )
374
- "#{ m } #{ model ( m ) } "
380
+ make = make ( )
381
+ "#{ make } #{ model ( make ) } "
375
382
end
376
383
377
384
@ doc """
@@ -380,13 +387,13 @@ defmodule Faker.Vehicle.En do
380
387
## Examples
381
388
382
389
iex> Faker.Vehicle.En.model()
383
- "CR-V "
390
+ "Encore "
384
391
iex> Faker.Vehicle.En.model()
385
- "Enclave "
392
+ "S5 "
386
393
iex> Faker.Vehicle.En.model()
387
- "Encore "
394
+ "Fiesta "
388
395
iex> Faker.Vehicle.En.model()
389
- "Verano "
396
+ "X1 "
390
397
"""
391
398
@ spec model ( ) :: String . t ( )
392
399
def model do
@@ -408,15 +415,10 @@ defmodule Faker.Vehicle.En do
408
415
iex> Faker.Vehicle.En.model("Toyota")
409
416
"Corolla"
410
417
"""
411
-
412
418
@ spec model ( String . t ( ) ) :: String . t ( )
413
- def model ( make ) do
414
- if Enum . member? ( @ makes , make ) do
415
- Util . pick ( @ models [ make ] )
416
- else
417
- model ( )
418
- end
419
- end
419
+ def model ( make ) when make in @ makes , do: Util . pick ( @ models [ make ] )
420
+
421
+ def model ( _make ) , do: model ( )
420
422
421
423
@ doc """
422
424
Returns a vehicle option string
0 commit comments