Class: Vindsl::VIN
- Inherits:
-
Object
- Object
- Vindsl::VIN
- Defined in:
- lib/vindsl/vin.rb
Instance Method Summary collapse
- #country ⇒ Object
-
#initialize(vin) ⇒ VIN
constructor
A new instance of VIN.
- #manufacturer ⇒ Object
- #model_year ⇒ Object
- #wmi ⇒ Object
Constructor Details
#initialize(vin) ⇒ VIN
Returns a new instance of VIN.
6 7 8 |
# File 'lib/vindsl/vin.rb', line 6 def initialize(vin) @vin = vin.upcase end |
Instance Method Details
#country ⇒ Object
14 15 16 |
# File 'lib/vindsl/vin.rb', line 14 def country WMI.country_for @vin end |
#manufacturer ⇒ Object
18 19 20 |
# File 'lib/vindsl/vin.rb', line 18 def manufacturer WMI.manufacturer_for @vin end |
#model_year ⇒ Object
22 23 24 25 26 27 |
# File 'lib/vindsl/vin.rb', line 22 def model_year year_character = position(10) base = pre_2009? ? 1980 : 2010 base + Vindsl::Alphabet::ALPHABET_FOR_YEARS.index(year_character) end |
#wmi ⇒ Object
10 11 12 |
# File 'lib/vindsl/vin.rb', line 10 def wmi @vin[0..3] end |