people_places_things 2.3.0 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.textile CHANGED
@@ -2,7 +2,7 @@ h1. PeoplePlacesThings
2
2
 
3
3
  PeoplePlacesThings is a collection of ruby classes for parsing and formatting U.S person names, street addresses, phone numbers, and more.
4
4
 
5
- <pre><code>gem install -s http://gemcutter.org people_places_things</code>></pre>
5
+ <pre><code>gem install -s http://gemcutter.org people_places_things</code></pre>
6
6
 
7
7
  h2. Using PeoplePlacesThings
8
8
 
data/Rakefile CHANGED
@@ -16,8 +16,10 @@ task :default => [:specs]
16
16
 
17
17
  begin
18
18
  require 'jeweler'
19
+ require 'lib/people_places_things'
19
20
  Jeweler::Tasks.new do |gemspec|
20
21
  gemspec.name = "people_places_things"
22
+ gemspec.version = PeoplePlacesThings::VERSION
21
23
  gemspec.summary = "Parsers and formatters for person names, street addresses, city/state/zip, phone numbers, etc."
22
24
  gemspec.email = "dburkes@netable.com"
23
25
  gemspec.homepage = "http://github.com/dburkes/people_places_things"
@@ -3,6 +3,7 @@ module PeoplePlacesThings
3
3
  attr_accessor :country_code, :area_code, :number, :exchange, :suffix, :raw
4
4
 
5
5
  def initialize(str)
6
+ self.raw = str
6
7
  extract = str.strip.match(/^([-+()\d ]+)$/)[0].gsub(/[^\d]/, '') rescue nil
7
8
  raise "Unsupported Format" if !extract || extract.length < 10 || extract.length > 11
8
9
 
@@ -3,6 +3,7 @@ module PeoplePlacesThings
3
3
  attr_accessor :number, :pre_direction, :name, :suffix, :post_direction, :unit_type, :unit, :raw
4
4
 
5
5
  def initialize(str)
6
+ self.raw = str
6
7
  tokens = str.split(/[\s,]/).select {|s| !s.empty?}
7
8
 
8
9
  # Check the first token for leading numericality. If so, set number to the first token, and delete it
@@ -3,6 +3,7 @@ module PeoplePlacesThings
3
3
  attr_accessor :base, :plus_four, :raw
4
4
 
5
5
  def initialize(str)
6
+ self.raw = str
6
7
  tokens = str.strip.match(/^(\d{5})(-\d{4})?$/)[0].split('-') rescue nil
7
8
  raise "Unsupported Format" if !tokens
8
9
 
@@ -7,5 +7,5 @@ require 'people_places_things/state'
7
7
  require 'people_places_things/location'
8
8
 
9
9
  module PeoplePlacesThings
10
- VERSION = File.read(File.join(File.dirname(__FILE__), 'people_places_things', 'VERSION')).chomp.strip rescue "Unknown"
10
+ VERSION = "2.3.1"
11
11
  end
@@ -1,15 +1,15 @@
1
1
  # Generated by jeweler
2
- # DO NOT EDIT THIS FILE
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{people_places_things}
8
- s.version = "2.3.0"
8
+ s.version = "2.3.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Danny Burkes"]
12
- s.date = %q{2009-09-01}
12
+ s.date = %q{2009-11-30}
13
13
  s.description = %q{Parsers and formatters for person names, street addresses, city/state/zip, phone numbers, etc.}
14
14
  s.email = %q{dburkes@netable.com}
15
15
  s.extra_rdoc_files = [
@@ -19,7 +19,6 @@ Gem::Specification.new do |s|
19
19
  ".gitignore",
20
20
  "README.textile",
21
21
  "Rakefile",
22
- "VERSION",
23
22
  "lib/people_places_things.rb",
24
23
  "lib/people_places_things/VERSION",
25
24
  "lib/people_places_things/ansi_counties.rb",
@@ -42,11 +41,10 @@ Gem::Specification.new do |s|
42
41
  "spec/street_address_spec.rb",
43
42
  "spec/zip_code_spec.rb"
44
43
  ]
45
- s.has_rdoc = true
46
44
  s.homepage = %q{http://github.com/dburkes/people_places_things}
47
45
  s.rdoc_options = ["--charset=UTF-8"]
48
46
  s.require_paths = ["lib"]
49
- s.rubygems_version = %q{1.3.1}
47
+ s.rubygems_version = %q{1.3.5}
50
48
  s.summary = %q{Parsers and formatters for person names, street addresses, city/state/zip, phone numbers, etc.}
51
49
  s.test_files = [
52
50
  "spec/ansi_counties_spec.rb",
@@ -61,7 +59,7 @@ Gem::Specification.new do |s|
61
59
 
62
60
  if s.respond_to? :specification_version then
63
61
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
64
- s.specification_version = 2
62
+ s.specification_version = 3
65
63
 
66
64
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
67
65
  else
@@ -69,3 +67,4 @@ Gem::Specification.new do |s|
69
67
  else
70
68
  end
71
69
  end
70
+
@@ -41,6 +41,10 @@ describe Location do
41
41
  test_location("94114-1212", nil, nil, '94114-1212')
42
42
  end
43
43
 
44
+ it "should save raw" do
45
+ Location.new('san francisco, ca').raw.should == 'san francisco, ca'
46
+ end
47
+
44
48
  private
45
49
 
46
50
  def test_location(str, city, state, zip)
@@ -172,4 +172,8 @@ describe PersonName do
172
172
  name.middle.should == 'quincy drake'
173
173
  name.last.should == 'peabody'
174
174
  end
175
+
176
+ it "should save raw" do
177
+ PersonName.new("ronald mcdonald").raw.should == 'ronald mcdonald'
178
+ end
175
179
  end
@@ -56,4 +56,8 @@ describe PhoneNumber do
56
56
  it "should throw exception on unsupported to_sformat" do
57
57
  lambda { PhoneNumber.new('14045551212').to_s(:bogus) }.should raise_error
58
58
  end
59
+
60
+ it "should save raw" do
61
+ PhoneNumber.new('14045551212').raw.should == '14045551212'
62
+ end
59
63
  end
data/spec/state_spec.rb CHANGED
@@ -26,4 +26,8 @@ describe State do
26
26
  it "should throw exception on unsupported to_s format" do
27
27
  lambda { State.new('ga').to_s(:bogus) }.should raise_error
28
28
  end
29
+
30
+ it "should save raw" do
31
+ State.new('georgia').raw.should == 'georgia'
32
+ end
29
33
  end
@@ -156,4 +156,8 @@ describe StreetAddress do
156
156
  it "should support short form when none exists" do
157
157
  StreetAddress.string_for(:oaks, :short).should == StreetAddress.string_for(:oaks, :long)
158
158
  end
159
+
160
+ it "should save raw" do
161
+ StreetAddress.new('123 Main st.').raw.should == '123 Main st.'
162
+ end
159
163
  end
@@ -24,4 +24,8 @@ describe ZipCode do
24
24
  it "should throw exception on unsupported to_s format" do
25
25
  lambda { ZipCode.new('30306-3522').to_s(:bogus) }.should raise_error
26
26
  end
27
+
28
+ it "should save raw format" do
29
+ ZipCode.new('30306-3522').raw.should == '30306-3522'
30
+ end
27
31
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: people_places_things
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Burkes
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-01 00:00:00 -07:00
12
+ date: 2009-11-30 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -25,7 +25,6 @@ files:
25
25
  - .gitignore
26
26
  - README.textile
27
27
  - Rakefile
28
- - VERSION
29
28
  - lib/people_places_things.rb
30
29
  - lib/people_places_things/VERSION
31
30
  - lib/people_places_things/ansi_counties.rb
@@ -73,7 +72,7 @@ requirements: []
73
72
  rubyforge_project:
74
73
  rubygems_version: 1.3.5
75
74
  signing_key:
76
- specification_version: 2
75
+ specification_version: 3
77
76
  summary: Parsers and formatters for person names, street addresses, city/state/zip, phone numbers, etc.
78
77
  test_files:
79
78
  - spec/ansi_counties_spec.rb
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 2.3.0