Class: Faker::Vehicle
Constant Summary
Constants inherited from Base
Base::Letters, Base::Numbers, Base::ULetters
Class Method Summary collapse
- .manufacture ⇒ Object
-
.vin ⇒ Object
ISO 3779.
Methods inherited from Base
bothify, fetch, fetch_all, flexible, letterify, method_missing, numerify, parse, rand_in_range, regexify, translate, with_locale
Class Method Details
.manufacture ⇒ Object
21 22 23 |
# File 'lib/faker/vehicle.rb', line 21 def manufacture fetch_all('vehicle.manufacture').sample["name"] end |
.vin ⇒ Object
ISO 3779
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/faker/vehicle.rb', line 9 def vin manufacture = fetch_all('vehicle.manufacture').sample c = @vin_chars.split('').reject{ |n| n == '.'} vehicle_identification_number = manufacture["wmi"].split('').concat( Array.new(14) { c.sample } ) (12..14).to_a.each_with_index { |n, i| vehicle_identification_number[n] = manufacture["win_ext"][i] } unless manufacture["win_ext"].nil? vehicle_identification_number[10] = fetch('vehicle.year') vehicle_identification_number[8] = vin_checksum(vehicle_identification_number) vehicle_identification_number.join.upcase end |