maverick_vin_parser 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'maverick_vin_parser'
4
+ require 'json'
4
5
 
5
6
  if ARGV.length != 1
6
7
  puts 'usage: maverick_vin_parser VIN'
@@ -9,7 +10,7 @@ end
9
10
 
10
11
 
11
12
  begin
12
- puts MaverickVinParser.new.parse(ARGV[0])
13
+ puts JSON.pretty_generate( MaverickVinParser.new.parse(ARGV[0]) )
13
14
  rescue MaverickVinParser::ArgumentError
14
15
  puts $!.message
15
16
  end
@@ -1,6 +1,8 @@
1
1
  require 'vin_constants'
2
2
 
3
-
3
+ # This class implements parsing of Vehicle Identification Numbers (VINs)
4
+ # for Ford Mavericks and Mercury Comets from 1970-77
5
+ #
4
6
  class MaverickVinParser
5
7
 
6
8
  include VinConstants
@@ -14,6 +16,15 @@ class MaverickVinParser
14
16
  @regex_main = /([0-7])(#{plant_code_regex})(#{body_code_regex})(#{engine_code_regex})([0-9]{6})/
15
17
  end
16
18
 
19
+ #
20
+ # Parses the provided VIN
21
+ #
22
+ # @param vin [string] The VIN to be parsed
23
+ # @return [hash] data parsed from the VIN
24
+ # @raise MaverickVinParser::ArgumentError if the VIN is invalid
25
+ # @example
26
+ # MaverickVinParser.new.parse('0X91U100647') #=> "{:year=>1970, :plant=>"St. Thomas", :body=>"Maverick 2-Door Sedan Standard", :engine=>"170ci 6-Cylinder 1 bbl", :unit_number=>100647}"
27
+ #
17
28
  def parse(vin)
18
29
  @regex_main.match(vin) do
19
30
  return {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maverick_vin_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -47,3 +47,4 @@ signing_key:
47
47
  specification_version: 3
48
48
  summary: VIN parser for Ford Mavericks
49
49
  test_files: []
50
+ has_rdoc: