Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vehicle version generator #2540

Merged
merged 3 commits into from
Aug 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was looking at that and thought it was odd too :P


# 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