Class: Vindetta::Generator
- Inherits:
-
Object
- Object
- Vindetta::Generator
- Defined in:
- lib/vindetta/generator.rb
Class Method Summary collapse
- .vds(_options = {}) ⇒ Object
- .vin(options = {}) ⇒ Object
- .vis(_options = {}) ⇒ Object
- .wmi(_options = {}) ⇒ Object
Class Method Details
.vds(_options = {}) ⇒ Object
18 19 20 |
# File 'lib/vindetta/generator.rb', line 18 def self.vds( = {}) VDS_CHARACTERS.sample(VDS_LENGTH).join("") end |
.vin(options = {}) ⇒ Object
3 4 5 6 7 |
# File 'lib/vindetta/generator.rb', line 3 def self.vin( = {}) "#{wmi}#{vds}#{vis}".tap do |vin| vin[CHECK_DIGIT_INDEX] = Calculator.check_digit(vin) end end |
.vis(_options = {}) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/vindetta/generator.rb', line 22 def self.vis( = {}) [ VIS_CHARACTERS.sample(VIS_LENGTH - 1), MODEL_YEAR_CHARACTERS.sample ].flatten.join("") end |
.wmi(_options = {}) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/vindetta/generator.rb', line 9 def self.wmi( = {}) @wmis ||= begin path = File.("../data/wmi.yaml", __FILE__) YAML.load_file(path)["wmi"].keys end "#{@wmis.sample}".rjust(WMI_LENGTH, "9") end |