Class: Vindetta::Generator
- Inherits:
-
Object
- Object
- Vindetta::Generator
- Defined in:
- lib/vindetta/generator.rb
Instance Attribute Summary collapse
-
#standard ⇒ Object
readonly
Returns the value of attribute standard.
Instance Method Summary collapse
-
#initialize(standard) ⇒ Generator
constructor
A new instance of Generator.
- #vds(_options = {}) ⇒ Object
- #vin(_options = {}) ⇒ Object
- #vis(_options = {}) ⇒ Object
- #wmi(_options = {}) ⇒ Object
Constructor Details
#initialize(standard) ⇒ Generator
Returns a new instance of Generator.
7 8 9 |
# File 'lib/vindetta/generator.rb', line 7 def initialize(standard) @standard = standard end |
Instance Attribute Details
#standard ⇒ Object (readonly)
Returns the value of attribute standard.
5 6 7 |
# File 'lib/vindetta/generator.rb', line 5 def standard @standard end |
Instance Method Details
#vds(_options = {}) ⇒ Object
21 22 23 |
# File 'lib/vindetta/generator.rb', line 21 def vds( = {}) characters("vds").map(&:sample).join end |
#vin(_options = {}) ⇒ Object
11 12 13 14 15 |
# File 'lib/vindetta/generator.rb', line 11 def vin( = {}) String.new("#{wmi}#{vds}#{vis}").tap do |vin| vin[CHECK_DIGIT_INDEX] = Calculator.check_digit(vin) end end |
#vis(_options = {}) ⇒ Object
25 26 27 |
# File 'lib/vindetta/generator.rb', line 25 def vis( = {}) characters("vis").map(&:sample).join end |
#wmi(_options = {}) ⇒ Object
17 18 19 |
# File 'lib/vindetta/generator.rb', line 17 def wmi( = {}) characters("wmi").map(&:sample).join end |