going_postal 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -1
- data/lib/going_postal.rb +8 -1
- metadata +40 -20
data/README.rdoc
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
= GoingPostal
|
2
2
|
|
3
3
|
The GoingPostal mixin provides classes with postcode formatting and validation
|
4
|
-
methods.
|
4
|
+
methods. It does _not_ provide external verification methods such as checking
|
5
|
+
for the existence of a postcode against the UK PAF database.
|
5
6
|
|
6
7
|
== Installation
|
7
8
|
|
data/lib/going_postal.rb
CHANGED
@@ -31,7 +31,8 @@
|
|
31
31
|
# GoingPostal.postcode?("200378001", "US") #=> "20037-8001"
|
32
32
|
#
|
33
33
|
# Currently supported countries are United Kingdom (GB, UK), United States (US),
|
34
|
-
# Canada (CA), Australia (AU), New Zeland (NZ),
|
34
|
+
# Canada (CA), Australia (AU), New Zeland (NZ), South Africa (ZA), and
|
35
|
+
# The Netherlands (NL).
|
35
36
|
#
|
36
37
|
# Ireland (IE) is supported insomuch as, Ireland doesn't use postcodes, so "" or
|
37
38
|
# nil are considered valid.
|
@@ -182,6 +183,12 @@ module GoingPostal
|
|
182
183
|
string if string =~ /^[1-9][0-9]{3}$/
|
183
184
|
end
|
184
185
|
|
186
|
+
def format_nl_postcode(string)
|
187
|
+
string = string.to_s.upcase.delete(" \t\r\n")
|
188
|
+
string.insert(4, " ")
|
189
|
+
string if string =~ /^[1-9][0-9]{3} (S[BCE-RT-Z]|[A-RT-Z][A-Z])$/
|
190
|
+
end
|
191
|
+
|
185
192
|
private
|
186
193
|
|
187
194
|
def get_args_for_format_postcode(args)
|
metadata
CHANGED
@@ -1,51 +1,71 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: going_postal
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Matthew Sadler
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
17
|
+
|
18
|
+
date: 2013-01-28 00:00:00 +00:00
|
19
|
+
default_executable:
|
13
20
|
dependencies: []
|
21
|
+
|
14
22
|
description: Post/zip code formatting and validation for the UK, US, CA and more.
|
15
23
|
email: mat@sourcetagsandcodes.com
|
16
24
|
executables: []
|
25
|
+
|
17
26
|
extensions: []
|
18
|
-
|
27
|
+
|
28
|
+
extra_rdoc_files:
|
19
29
|
- README.rdoc
|
20
|
-
files:
|
30
|
+
files:
|
21
31
|
- lib/going_postal.rb
|
22
32
|
- README.rdoc
|
33
|
+
has_rdoc: true
|
23
34
|
homepage: http://github.com/globaldev/going_postal
|
24
35
|
licenses: []
|
36
|
+
|
25
37
|
post_install_message:
|
26
|
-
rdoc_options:
|
38
|
+
rdoc_options:
|
27
39
|
- --main
|
28
40
|
- README.rdoc
|
29
41
|
- --charset
|
30
42
|
- utf-8
|
31
|
-
require_paths:
|
43
|
+
require_paths:
|
32
44
|
- lib
|
33
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
34
46
|
none: false
|
35
|
-
requirements:
|
36
|
-
- -
|
37
|
-
- !ruby/object:Gem::Version
|
38
|
-
|
39
|
-
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
hash: 3
|
51
|
+
segments:
|
52
|
+
- 0
|
53
|
+
version: "0"
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
40
55
|
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
hash: 3
|
60
|
+
segments:
|
61
|
+
- 0
|
62
|
+
version: "0"
|
45
63
|
requirements: []
|
64
|
+
|
46
65
|
rubyforge_project:
|
47
|
-
rubygems_version: 1.
|
66
|
+
rubygems_version: 1.6.2
|
48
67
|
signing_key:
|
49
68
|
specification_version: 3
|
50
69
|
summary: Global post/zip code formatting and validation mixin
|
51
70
|
test_files: []
|
71
|
+
|