Skip to content

Commit

Permalink
Add vehicle version generator (#2540)
Browse files Browse the repository at this point in the history
* Add vehicle version generator

* Reformat yml file

* Update vehicle.md

Just noticed this typo
  • Loading branch information
trinaldi authored Aug 26, 2022
1 parent 4ffc714 commit 9093f59
Show file tree
Hide file tree
Showing 4 changed files with 2,831 additions and 75 deletions.
5 changes: 5 additions & 0 deletions doc/default/vehicle.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ Faker::Vehicle.model(make_of_model: 'Toyota') #=> "Prius"
# Random vehicle make and model
Faker::Vehicle.make_and_model #=> "Dodge Charger"

# Random vehicle version
Faker::Vehicle.version #=> "2.5 Turbo"

Faker::Vehicle.version #=> "Altis Hybrid 1.8 16V CVT"

# Random vehicle color
Faker::Vehicle.color #=> "Red"

Expand Down
13 changes: 13 additions & 0 deletions lib/faker/default/vehicle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,19 @@ def singapore_license_plate
"#{plate_number}#{singapore_checksum(plate_number)}"
end

##
# Produces a car version
#
# @return [String]
#
# @example
# Faker::Vehicle.version #=> "40 TFSI Premium"
#
# @faker.version next
def version
fetch('vehicle.version')
end

private

def first_eight(number)
Expand Down
Loading

0 comments on commit 9093f59

Please sign in to comment.