snail 0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Lance Ivy
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,68 @@
1
+ = Snail
2
+
3
+ International snail mail addressing is a pain. This plugin begins to make it easier.
4
+
5
+ == How?
6
+
7
+ The basic idea is that mailing addresses need first and foremost to make it OUT of the originating country. It's beyond the scope of my current work to consider any originating country besides the United States, so that's where I am beginning. I will leave other countries of origination to the open source community.
8
+
9
+ Given the United States as a point of origin, my effort here is based on Frank's Compulsive Guide to Postal Addresses, available from http://www.columbia.edu/kermit/postal.html as of July 2009, and the USPS International Mail Manual (IMM), available from http://pe.usps.gov/text/imm/immidx.htm.
10
+
11
+ The United States Postal Service (USPS) requires (strongly prefers?) a few things:
12
+
13
+ * That the address be 5 lines long or less.
14
+ * That the last address line be a country name recognized by the USPS, in all uppercase.
15
+ * That the city line (comprising the city, state, and postal code as appropriate) immediately precede the country line.
16
+
17
+ The rest of the address should be formatted according to the rules of the receiving country.
18
+
19
+ Nearly all of the variation in formatting rules applies to the city line. Depending on the receiving country, the three component pieces (e.g. city, state, postal code) have different names, are pieced together in different order with different punctuation, and may or may not be required.
20
+
21
+ And then there's Great Britain, which Frank's Compulsive Guide describes as "where to find the most confusing addresses on earth" (a description confirmed and further confused by a source from within Royal Mail).
22
+
23
+ == The Future
24
+
25
+ I hope to tackle this plugin in stages, with help from the open source community:
26
+
27
+ # provide standardized USPS country names
28
+ # provide basic formatting rules for the city line in major countries
29
+ # provide basic country-specific validation logic
30
+ # build a best-practice form field generator to collect appropriate address information
31
+ # expand to other originating countries
32
+ # continue fleshing out the formatting and validation
33
+
34
+ == Example
35
+
36
+ Taking regular data and formatting it into an internationally mailable address:
37
+
38
+ Snail.new(
39
+ :name => "Jon Doe",
40
+ :line_1 => "12345 Somewhere Ln",
41
+ :line_2 => nil,
42
+ :city => "Bentley",
43
+ :region => "WA",
44
+ :postal_code => "6102",
45
+ :country => "Australia"
46
+ ).to_s
47
+
48
+ => "Jon Doe\n12345 Somewhere Ln\nBENTLEY WA 6102\nAUSTRALIA"
49
+
50
+ By default addresses with a country of USA are considered domestic and the country will
51
+ be left off any output. To change the home country:
52
+
53
+ Snail.home_country = "Australia"
54
+ Snail.new(
55
+ :name => "Jon Doe",
56
+ :line_1 => "12345 Somewhere Ln",
57
+ :line_2 => nil,
58
+ :city => "Bentley",
59
+ :region => "WA",
60
+ :postal_code => "6102",
61
+ :country => "Australia"
62
+ ).to_s
63
+
64
+ => "Jon Doe\n12345 Somewhere Ln\nBENTLEY WA 6102"
65
+
66
+ See the test cases for more.
67
+
68
+ Copyright (c) 2009 Lance Ivy, released under the MIT license
@@ -0,0 +1,105 @@
1
+ require 'snail/configurable'
2
+ require 'snail/constants'
3
+ require 'snail_helpers'
4
+
5
+ class Snail
6
+ include Configurable
7
+
8
+ # this will be raised whenever formatting or validation is run on an unsupported or unknown country
9
+ class UnknownCountryError < ArgumentError; end
10
+
11
+ # My made-up standard fields.
12
+ attr_accessor :name
13
+ attr_accessor :line_1
14
+ attr_accessor :line_2
15
+ attr_accessor :city
16
+ attr_accessor :region
17
+ attr_accessor :postal_code
18
+ attr_accessor :country
19
+
20
+ # Aliases for easier assignment compatibility
21
+ {
22
+ :full_name => :name,
23
+ :street => :line_1,
24
+ :town => :city,
25
+ :state => :region,
26
+ :province => :region,
27
+ :zip => :postal_code,
28
+ :zip_code => :postal_code,
29
+ :postcode => :postal_code
30
+ }.each do |new, existing|
31
+ alias_method "#{new}=", "#{existing}="
32
+ end
33
+
34
+ def self.home_country
35
+ @home_country ||= "USA"
36
+ end
37
+
38
+ def self.home_country=(val)
39
+ @home_country = val
40
+ end
41
+
42
+ def to_s
43
+ [name, line_1, line_2, city_line, country_line].select{|line| !(line.nil? or line.empty?)}.join("\n")
44
+ end
45
+
46
+ def to_html
47
+ "<address>#{to_s.gsub("\n", '<br />')}</address>"
48
+ end
49
+
50
+ # this method will get much larger. completeness is out of my scope at this time.
51
+ # currently it's based on the sampling of city line formats from frank's compulsive guide.
52
+ def city_line
53
+ case country
54
+ when 'China', 'India'
55
+ "#{city}, #{region} #{postal_code}"
56
+ when 'Brazil'
57
+ "#{postal_code} #{city}-#{region}"
58
+ when 'Mexico', 'Slovakia'
59
+ "#{postal_code} #{city}, #{region}"
60
+ when 'Italy'
61
+ "#{postal_code} #{city} (#{region})"
62
+ when 'Belarus'
63
+ "#{postal_code} #{city}-(#{region})"
64
+ when 'USA', 'Canada', 'Australia', nil, ""
65
+ "#{city} #{region} #{postal_code}"
66
+ when 'Israel', 'Denmark', 'Finland', 'France', 'Germany', 'Greece', 'Italy', 'Norway', 'Spain', 'Sweden', 'Turkey', 'Cyprus', 'Portugal', 'Macedonia', 'Bosnia and Herzegovina'
67
+ "#{postal_code} #{city}"
68
+ when 'Kuwait', 'Syria', 'Oman', 'Estonia','Luxembourg', 'Belgium', 'Iceland', 'Switzerland', 'Austria', 'Moldova', 'Montenegro', 'Serbia', 'Bulgaria', 'Georgia', 'Poland', 'Armenia', 'Croatia', 'Romania', 'Azerbaijan'
69
+ "#{postal_code} #{city}"
70
+ when 'Netherlands'
71
+ "#{postal_code} #{region} #{city}"
72
+ when 'Ireland'
73
+ "#{city}, #{region}"
74
+ when 'England', 'Scotland', 'Wales', 'United Kingdom', 'Russia', 'Russian Federation', 'Ukraine', 'Jordan', 'Lebanon','Iran, Islamic Republic of', 'Iran', 'Saudi Arabia', 'New Zealand'
75
+ "#{city} #{postal_code}" # Locally these may be on separate lines. The USPS prefers the city line above the country line, though.
76
+ when 'Ecuador'
77
+ "#{postal_code} #{city}"
78
+ when 'Hong Kong', 'Syria', 'Iraq', 'Yemen', 'Qatar', 'Albania'
79
+ "#{city}"
80
+ when 'United Arab Emirates'
81
+ "#{postal_code}\n#{city}"
82
+ when 'Japan'
83
+ "#{city}, #{region}\n#{postal_code}"
84
+ when 'Egypt', 'South Africa','Isle of Man', 'Kazakhstan', 'Hungary'
85
+ "#{city}\n#{postal_code}"
86
+ when 'Latvia'
87
+ "#{city}, LV-#{postal_code}"
88
+ when 'Lithuania'
89
+ "LT-#{postal_code} #{city}"
90
+ when 'Slovenia'
91
+ "SI-#{postal_code} #{city}"
92
+ when 'Czech Republic'
93
+ "#{postal_code} #{region}\n#{city}"
94
+ else
95
+ if Kernel.const_defined?("Rails")
96
+ Rails.logger.error "[Snail] Unknown Country: #{country}"
97
+ end
98
+ "#{city} #{region} #{postal_code}"
99
+ end
100
+ end
101
+
102
+ def country_line
103
+ self.class.home_country.to_s.upcase == country.to_s.upcase ? nil : country.to_s.upcase
104
+ end
105
+ end
@@ -0,0 +1,11 @@
1
+ class Snail
2
+ module Configurable
3
+ def initialize(options = {}, &block)
4
+ options.each do |k, v|
5
+ self.send("#{k}=", v)
6
+ end
7
+ yield self if block_given?
8
+ end
9
+ end
10
+ include Configurable
11
+ end
@@ -0,0 +1,307 @@
1
+ class Snail
2
+ # based on http://www.columbia.edu/kermit/postal.html#index, which is in turn based on
3
+ # the USPS International Mailing Manual. See also http://www.25thandclement.com/~william/USPS_ICL.html.
4
+ USPS_COUNTRIES = [
5
+ 'Afghanistan',
6
+ 'Albania',
7
+ 'Algeria',
8
+ 'andorra',
9
+ 'Angola',
10
+ 'Anguilla',
11
+ 'Antigua and Barbuda',
12
+ 'Argentina',
13
+ 'Armenia',
14
+ 'Aruba',
15
+ 'Ascension',
16
+ 'Australia',
17
+ 'Austria',
18
+ 'Azerbaijan',
19
+ 'Bahamas',
20
+ 'Bahrain',
21
+ 'Bangladesh',
22
+ 'Barbados',
23
+ 'Belarus',
24
+ 'Belgium',
25
+ 'Belize',
26
+ 'Benin',
27
+ 'Bermuda',
28
+ 'Bhutan',
29
+ 'Bolivia',
30
+ 'Bosnia Herzegovina',
31
+ 'Botswana',
32
+ 'Brazil',
33
+ 'British Virgin Islands',
34
+ 'Brunei Darrusalam',
35
+ 'Bulgaria',
36
+ 'Burkina Faso',
37
+ 'Burundi',
38
+ 'Cambodia',
39
+ 'Cameroon',
40
+ 'Canada',
41
+ 'Canary Islands',
42
+ 'Cape Verde',
43
+ 'Cayman Islands',
44
+ 'Central African Republic',
45
+ 'Chad',
46
+ 'Channel Islands',
47
+ 'Chile',
48
+ 'China',
49
+ 'Colombia',
50
+ 'Comoros',
51
+ 'Costa Rica',
52
+ 'CÔte D\'ivoire',
53
+ 'Croatia',
54
+ 'Cuba',
55
+ 'Curacao',
56
+ 'Cyprus',
57
+ 'Czech Republic',
58
+ 'Democratic Republic of the Congo',
59
+ 'Denmark',
60
+ 'Djibouti',
61
+ 'Dominica',
62
+ 'Dominican Republic',
63
+ 'East Timor',
64
+ 'Ecuador',
65
+ 'Egypt',
66
+ 'El Salvador',
67
+ 'England',
68
+ 'Equatorial Guinea',
69
+ 'Eritrea',
70
+ 'Estonia',
71
+ 'Ethiopia',
72
+ 'Falkland Islands',
73
+ 'Faroe Islands',
74
+ 'Fiji',
75
+ 'Finland',
76
+ 'France',
77
+ 'French Guiana',
78
+ 'French Polynesia',
79
+ 'Gabon',
80
+ 'Gambia',
81
+ 'Georgia',
82
+ 'Germany',
83
+ 'Ghana',
84
+ 'Gibraltar',
85
+ 'Greece',
86
+ 'Greenland',
87
+ 'Grenada',
88
+ 'Guadeloupe',
89
+ 'Guatemala',
90
+ 'Guinea',
91
+ 'Guinea Bissau',
92
+ 'Guyana',
93
+ 'Haiti',
94
+ 'Honduras',
95
+ 'Hong Kong',
96
+ 'Hungary',
97
+ 'Iceland',
98
+ 'India',
99
+ 'Indonesiai',
100
+ 'Iran',
101
+ 'Iraq',
102
+ 'Ireland',
103
+ 'Isle of Man',
104
+ 'Israel',
105
+ 'Italy',
106
+ 'Jamaica',
107
+ 'Japan',
108
+ 'Jordan',
109
+ 'Kazakhstan',
110
+ 'Kenya',
111
+ 'Kiribati',
112
+ 'Korea',
113
+ 'Kuwait',
114
+ 'Kyrgyzstan',
115
+ 'Laos',
116
+ 'Latvia',
117
+ 'Lebanon',
118
+ 'Lesotho',
119
+ 'Liberia',
120
+ 'Libya',
121
+ 'Liechtenstein',
122
+ 'Lithuania',
123
+ 'Luxembourg',
124
+ 'Macao',
125
+ 'Macedonia',
126
+ 'Madagascar',
127
+ 'Malawi',
128
+ 'Malaysia',
129
+ 'Maldives',
130
+ 'Mali',
131
+ 'Malta',
132
+ 'Martinique',
133
+ 'Mauritania',
134
+ 'Mauritius',
135
+ 'Mayotte',
136
+ 'Mexico',
137
+ 'Moldova',
138
+ 'Monaco',
139
+ 'Mongolia',
140
+ 'Montenegro',
141
+ 'Montserrat',
142
+ 'Morocco',
143
+ 'Mozambique',
144
+ 'Myanmar',
145
+ 'Namibia',
146
+ 'Nauru',
147
+ 'Nepal',
148
+ 'Netherlands',
149
+ 'Netherlands Antilles',
150
+ 'New Caledonia',
151
+ 'New Zealand',
152
+ 'Nicaragua',
153
+ 'Niger',
154
+ 'Nigeria',
155
+ 'North Korea',
156
+ 'Northern Ireland',
157
+ 'Norway',
158
+ 'Oman',
159
+ 'Pakistan',
160
+ 'Palestinian Territory',
161
+ 'Panama',
162
+ 'Papua New Guinea',
163
+ 'Paraguay',
164
+ 'Peru',
165
+ 'Philippines',
166
+ 'Pitcairn Island',
167
+ 'Poland',
168
+ 'Portugal',
169
+ 'Qatar',
170
+ 'Republic of the Congo',
171
+ 'Reunion',
172
+ 'Romania',
173
+ 'Russia',
174
+ 'Rwanda',
175
+ 'Saint Helena',
176
+ 'Saint Kitts and Nevis',
177
+ 'Saint Lucia',
178
+ 'Saint Pierre and Miquelon',
179
+ 'Saint Vincent and the Grenadines',
180
+ 'San Marino',
181
+ 'Sao Tome and Principe',
182
+ 'Saudi Arabia',
183
+ 'Scotlandg',
184
+ 'Senegal',
185
+ 'Serbia',
186
+ 'Seychelles',
187
+ 'Sierra Leone',
188
+ 'Singapore',
189
+ 'Slovak Republic',
190
+ 'Slovenia',
191
+ 'Solomon Islands',
192
+ 'Somalia',
193
+ 'South Africa',
194
+ 'South Georgia',
195
+ 'Spain',
196
+ 'Sri Lanka',
197
+ 'Sudan',
198
+ 'Suriname',
199
+ 'Swaziland',
200
+ 'Sweden',
201
+ 'Switzerland',
202
+ 'Syria',
203
+ 'Taiwan',
204
+ 'Tajikistan',
205
+ 'Tanzania',
206
+ 'Thailand',
207
+ 'Togo',
208
+ 'Tonga',
209
+ 'Trinidad and Tobago',
210
+ 'Tunisia',
211
+ 'Turkey',
212
+ 'Turkmenistan',
213
+ 'Turks and Caicos Islands',
214
+ 'Tuvalu',
215
+ 'Uganda',
216
+ 'Ukraine',
217
+ 'United Arab Emirates',
218
+ 'United Kingdom',
219
+ 'Uruguay',
220
+ 'USA',
221
+ 'Uzbekistan',
222
+ 'Vanuatu',
223
+ 'Vatican City',
224
+ 'Venezuela',
225
+ 'Vietnam',
226
+ 'Wales',
227
+ 'Wallis and Fortuna Islands',
228
+ 'Western Samoa',
229
+ 'Western Sahara',
230
+ 'Yemen',
231
+ 'Yugoslavia',
232
+ 'Zambia',
233
+ 'Zimbabwe'
234
+ ]
235
+
236
+ # see http://www.columbia.edu/kermit/postal.html#usa
237
+ # and http://www.usps.com/ncsc/lookups/usps_abbreviations.html
238
+ USA_STATES = {
239
+ "Alabama" => "AL",
240
+ "Alaska" => "AK",
241
+ "Arizona" => "AZ",
242
+ "Arkansas" => "AR",
243
+ "California" => "CA",
244
+ "Colorado" => "CO",
245
+ "Connecticut" => "CT",
246
+ "Delaware" => "DE",
247
+ "District Of Columbia" => "DC",
248
+ "Florida" => "FL",
249
+ "Georgia" => "GA",
250
+ "Hawaii" => "HI",
251
+ "Idaho" => "ID",
252
+ "Illinois" => "IL",
253
+ "Indiana" => "IN",
254
+ "Iowa" => "IA",
255
+ "Kansas" => "KS",
256
+ "Kentucky" => "KY",
257
+ "Louisiana" => "LA",
258
+ "Maine" => "ME",
259
+ "Maryland" => "MD",
260
+ "Massachusetts" => "MA",
261
+ "Michigan" => "MI",
262
+ "Minnesota" => "MN",
263
+ "Mississippi" => "MS",
264
+ "Missouri" => "MO",
265
+ "Montana" => "MT",
266
+ "Nebraska" => "NE",
267
+ "Nevada" => "NV",
268
+ "New Hampshire" => "NH",
269
+ "New Jersey" => "NJ",
270
+ "New Mexico" => "NM",
271
+ "New York" => "NY",
272
+ "North Carolina" => "NC",
273
+ "North Dakota" => "ND",
274
+ "Ohio" => "OH",
275
+ "Oklahoma" => "OK",
276
+ "Oregon" => "OR",
277
+ "Pennsylvania" => "PA",
278
+ "Rhode Island" => "RI",
279
+ "South Carolina" => "SC",
280
+ "South Dakota" => "SD",
281
+ "Tennessee" => "TN",
282
+ "Texas" => "TX",
283
+ "Utah" => "UT",
284
+ "Vermont" => "VT",
285
+ "Virginia" => "VA",
286
+ "Washington" => "WA",
287
+ "West Virginia" => "WV",
288
+ "Wisconsin" => "WI",
289
+ "Wyoming" => "WY",
290
+
291
+ # These are not states exactly, but they are addressed as states through USA
292
+ "American Samoa" => "AS",
293
+ "Federated States Of Micronesia" => "FM",
294
+ "Guam" => "GU",
295
+ "Marshall Islands" => "MH",
296
+ "Northern Mariana Islands" => "MP",
297
+ "Palau" => "PW",
298
+ "Puerto Rico" => "PR",
299
+ "Virgin Islands" => "VI",
300
+ "Armed Forces Africa" => "AE",
301
+ "Armed Forces Americas (Except Canada)" => "AA",
302
+ "Armed Forces Canada" => "AE",
303
+ "Armed Forces Europe" => "AE",
304
+ "Armed Forces Middle East" => "AE",
305
+ "Armed Forces Pacific" => "AP",
306
+ }
307
+ end
@@ -0,0 +1,9 @@
1
+ module SnailHelpers
2
+ def usps_country_options_for_select(selected = nil, default_selected = 'USA')
3
+ options_for_select(Snail::USPS_COUNTRIES, selected || default_selected)
4
+ end
5
+
6
+ def usa_state_options_for_select(selected = nil)
7
+ options_for_select(Snail::USA_STATES, selected)
8
+ end
9
+ end
@@ -0,0 +1,99 @@
1
+ require File.dirname(__FILE__) + '/test_helper'
2
+
3
+ class SnailTest < ActiveSupport::TestCase
4
+ def setup
5
+ @us = {:name => "John Doe", :line_1 => "12345 5th St", :city => "Somewheres", :state => "NY", :zip => "12345", :country => 'USA'}
6
+ @ca = {:name => "John Doe", :line_1 => "12345 5th St", :city => "Somewheres", :state => "NY", :zip => "12345", :country => 'Canada'}
7
+ end
8
+
9
+ test "provides USPS country names" do
10
+ assert Snail.const_defined?('USPS_COUNTRIES')
11
+ end
12
+
13
+ test "provides USA state names with abbreviations" do
14
+ assert Snail.const_defined?('USA_STATES')
15
+ assert_equal 'MN', Snail::USA_STATES['Minnesota']
16
+ end
17
+
18
+ test "USA states include territories and islands" do
19
+ assert Snail::USA_STATES['Guam']
20
+ end
21
+
22
+ ##
23
+ ## Configuration
24
+ ##
25
+
26
+ test "initializes from a hash" do
27
+ s = Snail.new(:name => "John Doe", :city => "Somewheres")
28
+ assert_equal 'John Doe', s.name
29
+ assert_equal 'Somewheres', s.city
30
+ end
31
+
32
+ test "aliases common city synonyms" do
33
+ assert_equal Snail.new(:town => "Somewheres").city, Snail.new(:city => "Somewheres").city
34
+ end
35
+
36
+ test "aliases common region synonyms" do
37
+ assert_equal Snail.new(:state => "Somewheres").region, Snail.new(:region => "Somewheres").region
38
+ assert_equal Snail.new(:province => "Somewheres").region, Snail.new(:region => "Somewheres").region
39
+ end
40
+
41
+ test "aliases common postal code synonyms" do
42
+ assert_equal Snail.new(:zip => "12345").postal_code, Snail.new(:postal_code => "12345").postal_code
43
+ assert_equal Snail.new(:zip_code => "12345").postal_code, Snail.new(:postal_code => "12345").postal_code
44
+ assert_equal Snail.new(:postcode => "12345").postal_code, Snail.new(:postal_code => "12345").postal_code
45
+ end
46
+
47
+ ##
48
+ ## Formatting
49
+ ##
50
+
51
+ test "includes two spaces between region and zip for domestic mail" do
52
+ s = Snail.new(@us)
53
+ assert /NY 12345/, s.city_line
54
+ end
55
+
56
+ test "does not include country name for domestic addresses" do
57
+ s = Snail.new(@us)
58
+ assert !s.to_s.match(/United States/i)
59
+ end
60
+
61
+ test "does not include country name for domestic addresses in canada" do
62
+ Snail.home_country = "Canada"
63
+ s = Snail.new(@ca)
64
+ assert !s.to_s.match(/Canada/i)
65
+ Snail.home_country = "USA"
66
+ end
67
+
68
+ test "includes country name for international addresses" do
69
+ s = Snail.new(@ca)
70
+ assert s.to_s.match(/Canada/i)
71
+ end
72
+
73
+ test "output ok if country is nil" do
74
+ s = Snail.new(@ca.merge(:country => nil))
75
+ assert s.to_s[-5,5] == "12345"
76
+ end
77
+
78
+ test "country names are uppercased" do
79
+ s = Snail.new(@ca)
80
+ assert s.to_s.match(/CANADA/)
81
+ end
82
+
83
+ test "empty lines are removed" do
84
+ s = Snail.new(@us.merge(:line_1 => ""))
85
+ assert !s.to_s.match(/^$/)
86
+ end
87
+
88
+ test "to_s" do
89
+ s = Snail.new(@ca)
90
+ assert_equal "John Doe\n12345 5th St\nSomewheres NY 12345\nCANADA", s.to_s
91
+ end
92
+
93
+ test "to_html" do
94
+ s = Snail.new(@ca)
95
+ assert_equal "<address>John Doe<br />12345 5th St<br />Somewheres NY 12345<br />CANADA</address>", s.to_html
96
+ end
97
+ end
98
+
99
+
@@ -0,0 +1,8 @@
1
+ require 'rubygems'
2
+ require 'active_support'
3
+ require 'active_support/test_case'
4
+ require 'test/unit'
5
+
6
+ $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
7
+
8
+ require 'snail'
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: snail
3
+ version: !ruby/object:Gem::Version
4
+ hash: 1
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 5
9
+ version: "0.5"
10
+ platform: ruby
11
+ authors:
12
+ - Lance Ivy
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-08-30 00:00:00 -07:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: International snail mail addressing is a pain. This begins to make it easier.
22
+ email: lance@cainlevy.net
23
+ executables: []
24
+
25
+ extensions: []
26
+
27
+ extra_rdoc_files: []
28
+
29
+ files:
30
+ - lib/snail/constants.rb
31
+ - lib/snail/configurable.rb
32
+ - lib/snail_helpers.rb
33
+ - lib/snail.rb
34
+ - test/snail_test.rb
35
+ - test/test_helper.rb
36
+ - README.rdoc
37
+ - MIT-LICENSE
38
+ has_rdoc: true
39
+ homepage: http://github.com/cainlevy/snail
40
+ licenses: []
41
+
42
+ post_install_message:
43
+ rdoc_options:
44
+ - --title
45
+ - Snail
46
+ - --line-numbers
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ hash: 3
55
+ segments:
56
+ - 0
57
+ version: "0"
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ hash: 3
64
+ segments:
65
+ - 0
66
+ version: "0"
67
+ requirements: []
68
+
69
+ rubyforge_project:
70
+ rubygems_version: 1.3.7
71
+ signing_key:
72
+ specification_version: 3
73
+ summary: Easily format snail mail addresses for international delivery
74
+ test_files: []
75
+