Class: Vindetta::Decoder

Inherits:
Object
  • Object
show all
Defined in:
lib/vindetta/decoder.rb

Constant Summary collapse

BASE_MODEL_YEAR =
1980
ALPHA =
("A".."Z").to_a
NUMERIC =
("0".."9").to_a

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(standard) ⇒ Decoder

Returns a new instance of Decoder.



11
12
13
# File 'lib/vindetta/decoder.rb', line 11

def initialize(standard)
  @standard = standard
end

Instance Attribute Details

#standardObject (readonly)

Returns the value of attribute standard.



5
6
7
# File 'lib/vindetta/decoder.rb', line 5

def standard
  @standard
end

Instance Method Details

#vin(vin) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/vindetta/decoder.rb', line 15

def vin(vin)
  {
    plant_code: vin[PLANT_CODE_INDEX],
    wmi: vin[WMI_RANGE],
    check_digit: vin[CHECK_DIGIT_INDEX],
    production_number: vin[PRODUCTION_NUMBER_RANGE],
    model_year: model_year(vin),
    region: region(vin)
  }
end