postal_code 0.0.1 → 0.2.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,10 +1,10 @@
1
1
  module PostalCode
2
2
 
3
- VERSION = '0.0.1'
3
+ VERSION = '0.2.0'
4
4
 
5
5
  CityOffset = 0
6
6
  StateOffset = 1
7
- DB = File.join File.dirname(__FILE__), '..', 'db', 'us.csv'
7
+ DB = File.join File.dirname(__FILE__), '..', 'db', 'US.tsv'
8
8
  FS = "\t" # field separator
9
9
  RS = "\n" # record separator
10
10
 
@@ -16,7 +16,8 @@ module PostalCode
16
16
  def self.load_cache
17
17
  open(DB) do |db|
18
18
  db.each_line do |line|
19
- pcode, city, state = line.rstrip.split(FS)
19
+ line.rstrip! # remove RS
20
+ pcode, city, state = line.split(FS)
20
21
  @cache[pcode] = [city, state]
21
22
  end
22
23
  end
@@ -7,6 +7,6 @@ Gem::Specification.new('postal_code') do |s|
7
7
  s.summary = 'Postal Code Resolver'
8
8
  s.description = 'Resolves a postal code to a corresponding city or state.'
9
9
  s.files = Dir['README.rdoc', 'Rakefile', 'postal_code.gemspec',
10
- 'lib/**/*.rb', 'test/**/*', 'db/*.csv']
10
+ 'lib/**/*.rb', 'test/**/*', 'db/*.tsv']
11
11
  s.test_files = Dir['test/*.rb']
12
12
  end
File without changes
@@ -1,11 +1,10 @@
1
- gem 'minitest' # minitest in 1.9 stdlib is crufty
2
1
  require 'minitest/autorun'
3
2
  require 'postal_code'
4
3
 
5
- class PostalCodeTest < Minitest::Test
4
+ class PostalCodeTest < Minitest::Unit::TestCase
6
5
 
7
6
  ProductionDB = PostalCode::DB.dup
8
- TestDB = File.dirname(__FILE__) + '/data/us.csv'
7
+ TestDB = File.dirname(__FILE__) + '/data/US.tsv'
9
8
  PostalCode::DB.replace(TestDB)
10
9
 
11
10
  def test_database_format
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: postal_code
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
5
- prerelease:
4
+ version: 0.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Clint Pachl
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-05-02 00:00:00.000000000 Z
11
+ date: 2015-01-15 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: Resolves a postal code to a corresponding city or state.
15
14
  email: pachl@ecentryx.com
@@ -19,36 +18,35 @@ extra_rdoc_files: []
19
18
  files:
20
19
  - README.rdoc
21
20
  - Rakefile
22
- - postal_code.gemspec
23
- - lib/postal_code/server.rb
21
+ - db/US.tsv
24
22
  - lib/postal_code.rb
23
+ - lib/postal_code/server.rb
24
+ - postal_code.gemspec
25
+ - test/data/US.tsv
25
26
  - test/test_postal_code.rb
26
- - test/data/us.csv
27
- - db/us.csv
28
27
  homepage: http://ecentryx.com/gems/postal_code
29
28
  licenses:
30
29
  - ISC
30
+ metadata: {}
31
31
  post_install_message:
32
32
  rdoc_options: []
33
33
  require_paths:
34
34
  - lib
35
35
  required_ruby_version: !ruby/object:Gem::Requirement
36
- none: false
37
36
  requirements:
38
- - - ! '>='
37
+ - - ">="
39
38
  - !ruby/object:Gem::Version
40
39
  version: '0'
41
40
  required_rubygems_version: !ruby/object:Gem::Requirement
42
- none: false
43
41
  requirements:
44
- - - ! '>='
42
+ - - ">="
45
43
  - !ruby/object:Gem::Version
46
44
  version: '0'
47
45
  requirements: []
48
46
  rubyforge_project:
49
- rubygems_version: 1.8.23
47
+ rubygems_version: 2.2.2
50
48
  signing_key:
51
- specification_version: 3
49
+ specification_version: 4
52
50
  summary: Postal Code Resolver
53
51
  test_files:
54
52
  - test/test_postal_code.rb