Sha256: 7a444938de827a78e5b3f2c7dfaecf26cddc4108a932ef1b38300d5a219d3f87
Contents?: true
Size: 579 Bytes
Versions: 1
Compression:
Stored size: 579 Bytes
Contents
require 'vindsl/wmi' require 'vindsl/alphabet' module Vindsl class VIN def initialize(vin) @vin = vin.upcase end def wmi @vin[0..3] end def country WMI.country_for @vin end def manufacturer WMI.manufacturer_for @vin end def model_year year_character = position(10) base = pre_2009? ? 1980 : 2010 base + Vindsl::Alphabet::ALPHABET_WITH_NUMBERS.index(year_character) end private def position(n) @vin[n-1] end def pre_2009? position(7) =~ /\d/ end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vindsl-0.0.1 | lib/vindsl/vin.rb |