addressable_record 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/README.rdoc +2 -0
- data/Rakefile +20 -20
- data/VERSION +1 -1
- data/addressable_record.gemspec +10 -9
- data/lib/addressable_record/address.rb +3 -1
- metadata +61 -78
- data/.rvmrc +0 -2
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
gemdev
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-1.9.3-p429
|
data/README.rdoc
CHANGED
@@ -102,6 +102,8 @@ Reference the sub parts of the field:
|
|
102
102
|
@user.home_address.state # => GA
|
103
103
|
@user.home_address.province # => GA
|
104
104
|
@user.home_address.zip_code # => 33333-1111
|
105
|
+
@user.home_address.zip_code_prefix # => 33333
|
106
|
+
@user.home_address.zip_code_ext # => 1111
|
105
107
|
@user.home_address.country # => U.S.A.
|
106
108
|
|
107
109
|
Use formats to control the output:
|
data/Rakefile
CHANGED
@@ -20,28 +20,28 @@ rescue LoadError
|
|
20
20
|
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
21
21
|
end
|
22
22
|
|
23
|
-
require 'spec/rake/spectask'
|
24
|
-
Spec::Rake::SpecTask.new(:spec) do |spec|
|
25
|
-
spec.libs << 'lib' << 'spec'
|
26
|
-
spec.spec_files = FileList['spec/**/*_spec.rb']
|
27
|
-
end
|
23
|
+
#require 'spec/rake/spectask'
|
24
|
+
#Spec::Rake::SpecTask.new(:spec) do |spec|
|
25
|
+
#spec.libs << 'lib' << 'spec'
|
26
|
+
#spec.spec_files = FileList['spec/**/*_spec.rb']
|
27
|
+
#end
|
28
28
|
|
29
|
-
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
30
|
-
spec.libs << 'lib' << 'spec'
|
31
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
32
|
-
spec.rcov = true
|
33
|
-
end
|
29
|
+
#Spec::Rake::SpecTask.new(:rcov) do |spec|
|
30
|
+
#spec.libs << 'lib' << 'spec'
|
31
|
+
#spec.pattern = 'spec/**/*_spec.rb'
|
32
|
+
#spec.rcov = true
|
33
|
+
#end
|
34
34
|
|
35
|
-
task :spec => :check_dependencies
|
35
|
+
#task :spec => :check_dependencies
|
36
36
|
|
37
|
-
task :default => :spec
|
37
|
+
#task :default => :spec
|
38
38
|
|
39
|
-
require 'rake/rdoctask'
|
40
|
-
Rake::RDocTask.new do |rdoc|
|
41
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
39
|
+
#require 'rake/rdoctask'
|
40
|
+
#Rake::RDocTask.new do |rdoc|
|
41
|
+
#version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
42
42
|
|
43
|
-
rdoc.rdoc_dir = 'rdoc'
|
44
|
-
rdoc.title = "addressable_record #{version}"
|
45
|
-
rdoc.rdoc_files.include('README*')
|
46
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
47
|
-
end
|
43
|
+
#rdoc.rdoc_dir = 'rdoc'
|
44
|
+
#rdoc.title = "addressable_record #{version}"
|
45
|
+
#rdoc.rdoc_files.include('README*')
|
46
|
+
#rdoc.rdoc_files.include('lib/**/*.rb')
|
47
|
+
#end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.4.0
|
data/addressable_record.gemspec
CHANGED
@@ -4,21 +4,22 @@
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "1.
|
7
|
+
s.name = "addressable_record"
|
8
|
+
s.version = "1.4.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["C. Jason Harrelson (midas)"]
|
12
|
-
s.date =
|
13
|
-
s.description =
|
14
|
-
s.email =
|
12
|
+
s.date = "2013-09-20"
|
13
|
+
s.description = "Encapsulates the composed of pattern for addresses into any easy to use library. Provides convenience methods for formatting, parsing, etc."
|
14
|
+
s.email = "jason@lookforwardenterprises.com"
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
17
|
"README.rdoc"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
|
-
".
|
21
|
+
".ruby-gemset",
|
22
|
+
".ruby-version",
|
22
23
|
"History.txt",
|
23
24
|
"LICENSE",
|
24
25
|
"README.rdoc",
|
@@ -41,10 +42,10 @@ Gem::Specification.new do |s|
|
|
41
42
|
"spec/spec.opts",
|
42
43
|
"spec/spec_helper.rb"
|
43
44
|
]
|
44
|
-
s.homepage =
|
45
|
+
s.homepage = "http://github.com/midas/addressable_record"
|
45
46
|
s.require_paths = ["lib"]
|
46
|
-
s.rubygems_version =
|
47
|
-
s.summary =
|
47
|
+
s.rubygems_version = "1.8.25"
|
48
|
+
s.summary = "Encapsulates the composed of pattern for addresses into any easy to use library."
|
48
49
|
|
49
50
|
if s.respond_to? :specification_version then
|
50
51
|
s.specification_version = 3
|
@@ -7,7 +7,7 @@ module AddressableRecord
|
|
7
7
|
NATURAL_STRING_REGEX = /^(.+),\s*(.+),\s*(.+),\s*(.{2})\s*(\d{5})-?(\d{4})?\s*$/
|
8
8
|
CSV_STRING_REGEX = /^(.+),\s*(.+),\s*(.+),\s*(.{2}),\s*(\d{5})-?(\d{4})?\s*$/
|
9
9
|
|
10
|
-
attr_reader :raw_street, :streets, :city, :state_or_province, :zip_code, :country
|
10
|
+
attr_reader :raw_street, :streets, :city, :state_or_province, :zip_code, :zip_code_prefix, :zip_code_ext, :country
|
11
11
|
|
12
12
|
@@street_delimiter ||= '###'
|
13
13
|
@@zip_code_delimiter ||= '-'
|
@@ -23,6 +23,8 @@ module AddressableRecord
|
|
23
23
|
@streets = AddressableRecord::Address.parse_street( attrs[:raw_street] || '' )
|
24
24
|
raw_zip = (attrs[:raw_zip_code] || '')
|
25
25
|
@zip_code = raw_zip.size == 5 ? raw_zip : raw_zip.gsub( /(\d{5})(\d{4})/, "\\1#{@@zip_code_delimiter}\\2" )
|
26
|
+
@zip_code_prefix = raw_zip.gsub( /(\d{5})(\d{4}?)/, "\\1" )
|
27
|
+
@zip_code_ext = raw_zip.gsub( /(\d{5})(\d{4}?)/, "\\2" )
|
26
28
|
|
27
29
|
@pattern_map = {
|
28
30
|
'%s' => @streets.join( ', ' ) || "",
|
metadata
CHANGED
@@ -1,82 +1,76 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: addressable_record
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.4.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 3
|
9
|
-
- 0
|
10
|
-
version: 1.3.0
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- C. Jason Harrelson (midas)
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-09-20 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
22
15
|
name: geographer
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
25
17
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 17
|
30
|
-
segments:
|
31
|
-
- 1
|
32
|
-
- 1
|
33
|
-
- 1
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
34
21
|
version: 1.1.1
|
35
22
|
type: :runtime
|
36
|
-
version_requirements: *id001
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: activerecord
|
39
23
|
prerelease: false
|
40
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.1.1
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: activerecord
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
41
33
|
none: false
|
42
|
-
requirements:
|
43
|
-
- -
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
|
46
|
-
segments:
|
47
|
-
- 2
|
48
|
-
- 3
|
49
|
-
version: "2.3"
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '2.3'
|
50
38
|
type: :runtime
|
51
|
-
version_requirements: *id002
|
52
|
-
- !ruby/object:Gem::Dependency
|
53
|
-
name: rspec
|
54
39
|
prerelease: false
|
55
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
56
41
|
none: false
|
57
|
-
requirements:
|
58
|
-
- -
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '2.3'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rspec
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
65
53
|
version: 1.2.9
|
66
54
|
type: :development
|
67
|
-
|
68
|
-
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.2.9
|
62
|
+
description: Encapsulates the composed of pattern for addresses into any easy to use
|
63
|
+
library. Provides convenience methods for formatting, parsing, etc.
|
69
64
|
email: jason@lookforwardenterprises.com
|
70
65
|
executables: []
|
71
|
-
|
72
66
|
extensions: []
|
73
|
-
|
74
|
-
extra_rdoc_files:
|
67
|
+
extra_rdoc_files:
|
75
68
|
- LICENSE
|
76
69
|
- README.rdoc
|
77
|
-
files:
|
70
|
+
files:
|
78
71
|
- .document
|
79
|
-
- .
|
72
|
+
- .ruby-gemset
|
73
|
+
- .ruby-version
|
80
74
|
- History.txt
|
81
75
|
- LICENSE
|
82
76
|
- README.rdoc
|
@@ -98,39 +92,28 @@ files:
|
|
98
92
|
- spec/database.yml
|
99
93
|
- spec/spec.opts
|
100
94
|
- spec/spec_helper.rb
|
101
|
-
has_rdoc: true
|
102
95
|
homepage: http://github.com/midas/addressable_record
|
103
96
|
licenses: []
|
104
|
-
|
105
97
|
post_install_message:
|
106
98
|
rdoc_options: []
|
107
|
-
|
108
|
-
require_paths:
|
99
|
+
require_paths:
|
109
100
|
- lib
|
110
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
111
102
|
none: false
|
112
|
-
requirements:
|
113
|
-
- -
|
114
|
-
- !ruby/object:Gem::Version
|
115
|
-
|
116
|
-
|
117
|
-
- 0
|
118
|
-
version: "0"
|
119
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ! '>='
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
108
|
none: false
|
121
|
-
requirements:
|
122
|
-
- -
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
|
125
|
-
segments:
|
126
|
-
- 0
|
127
|
-
version: "0"
|
109
|
+
requirements:
|
110
|
+
- - ! '>='
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
128
113
|
requirements: []
|
129
|
-
|
130
114
|
rubyforge_project:
|
131
|
-
rubygems_version: 1.
|
115
|
+
rubygems_version: 1.8.25
|
132
116
|
signing_key:
|
133
117
|
specification_version: 3
|
134
118
|
summary: Encapsulates the composed of pattern for addresses into any easy to use library.
|
135
119
|
test_files: []
|
136
|
-
|
data/.rvmrc
DELETED