validates_as_uk_postcode 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/rails2.rb CHANGED
@@ -1,15 +1,4 @@
1
1
  module ValidatesAsUKPostcode
2
- module Postcodes
3
- UK = begin
4
- an_naa_or_ann_naa = '^[A-PR-UWYZ]{1}\d{1,2}\s?\d[ABD-HJLNP-UWXYZ]{2}$'
5
- aan_naa_or_aann_naa = '^[A-PR-UWYZ]{1}[A-HK-Y]{1}\d{1,2}\s?\d[ABD-HJLNP-UWXYZ]{2}$'
6
- ana_naa = '^[A-PR-UWYZ]{1}\d[A-HJKSTUW]{1}\s?\d[ABD-HJLNP-UWXYZ]{2}$'
7
- aana_naa = '^[A-PR-UWYZ]{1}[A-HK-Y]{1}\d[ABEHMNPRVWXY]{1}\s?\d[ABD-HJLNP-UWXYZ]{2}$'
8
- historic_code="GIR\s?0AA"
9
- postcode_spec = "#{an_naa_or_ann_naa}|#{aan_naa_or_aann_naa}|#{ana_naa}|#{aana_naa}|#{historic_code}"
10
- pattern = /#{postcode_spec}/i
11
- end
12
- end
13
2
 
14
3
  module Rails2
15
4
 
data/lib/rails3.rb CHANGED
@@ -2,17 +2,6 @@ require 'active_support/concern'
2
2
  require 'active_model'
3
3
 
4
4
  module ValidatesAsUKPostcode
5
- module Postcodes
6
- UK = begin
7
- an_naa_or_ann_naa = '^[A-PR-UWYZ]{1}\d{1,2}\s?\d[ABD-HJLNP-UWXYZ]{2}$'
8
- aan_naa_or_aann_naa = '^[A-PR-UWYZ]{1}[A-HK-Y]{1}\d{1,2}\s?\d[ABD-HJLNP-UWXYZ]{2}$'
9
- ana_naa = '^[A-PR-UWYZ]{1}\d[A-HJKSTUW]{1}\s?\d[ABD-HJLNP-UWXYZ]{2}$'
10
- aana_naa = '^[A-PR-UWYZ]{1}[A-HK-Y]{1}\d[ABEHMNPRVWXY]{1}\s?\d[ABD-HJLNP-UWXYZ]{2}$'
11
- historic_code="GIR\s?0AA"
12
- postcode_spec = "#{an_naa_or_ann_naa}|#{aan_naa_or_aann_naa}|#{ana_naa}|#{aana_naa}|#{historic_code}"
13
- pattern = /#{postcode_spec}/i
14
- end
15
- end
16
5
 
17
6
  module Rails3
18
7
  extend ActiveSupport::Concern
@@ -1,3 +1,17 @@
1
+ module ValidatesAsUKPostcode
2
+ module Postcodes
3
+ UK = begin
4
+ an_naa_or_ann_naa = '^[A-PR-UWYZ]{1}\d{1,2}\s?\d[ABD-HJLNP-UWXYZ]{2}$'
5
+ aan_naa_or_aann_naa = '^[A-PR-UWYZ]{1}[A-HK-Y]{1}\d{1,2}\s?\d[ABD-HJLNP-UWXYZ]{2}$'
6
+ ana_naa = '^[A-PR-UWYZ]{1}\d[A-HJKSTUW]{1}\s?\d[ABD-HJLNP-UWXYZ]{2}$'
7
+ aana_naa = '^[A-PR-UWYZ]{1}[A-HK-Y]{1}\d[ABEHMNPRVWXY]{1}\s?\d[ABD-HJLNP-UWXYZ]{2}$'
8
+ historic_code="GIR\s?0AA"
9
+ postcode_spec = "#{an_naa_or_ann_naa}|#{aan_naa_or_aann_naa}|#{ana_naa}|#{aana_naa}|#{historic_code}"
10
+ pattern = /#{postcode_spec}/i
11
+ end
12
+ end
13
+ end
14
+
1
15
  if Rails::VERSION::MAJOR >= 3
2
16
  require 'rails3'
3
17
  ActiveRecord::Base.send(:include, ValidatesAsUKPostcode::Rails3)
@@ -1,6 +1,6 @@
1
1
  require 'rubygems'
2
2
 
3
- gem 'rails', '2.3.8'
3
+ gem 'rails', '2.3.11'
4
4
 
5
5
  require 'sqlite3'
6
6
  require 'test/unit'
@@ -13,7 +13,13 @@ ActiveRecord::Base.establish_connection(
13
13
  "database" => ":memory:"
14
14
  )
15
15
 
16
- require File.join(File.dirname(__FILE__), '..', '..', 'lib', 'rails2.rb')
16
+ module Rails
17
+ module VERSION
18
+ MAJOR = 2
19
+ end
20
+ end
21
+
22
+ require File.join(File.dirname(__FILE__), '..', '..', 'lib', 'validates_as_uk_postcode.rb')
17
23
 
18
24
  ActiveRecord::Base.send(:extend, ValidatesAsUKPostcode::Rails2)
19
25
 
@@ -13,8 +13,12 @@ ActiveRecord::Base.establish_connection(
13
13
  "database" => ":memory:"
14
14
  )
15
15
 
16
- require File.join(File.dirname(__FILE__), '..', '..', 'lib', 'rails3.rb')
16
+ module Rails
17
+ module VERSION
18
+ MAJOR = 3
19
+ end
20
+ end
17
21
 
18
- ActiveRecord::Base.send(:include, ValidatesAsUKPostcode::Rails3)
22
+ require File.join(File.dirname(__FILE__), '..', '..', 'lib', 'validates_as_uk_postcode.rb')
19
23
 
20
24
  autoload :AbstractModel, File.join(File.dirname(__FILE__), 'models', 'abstract_model.rb')
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: validates_as_uk_postcode
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ hash: 11
5
+ prerelease:
5
6
  segments:
6
7
  - 2
7
8
  - 0
8
- - 1
9
- version: 2.0.1
9
+ - 2
10
+ version: 2.0.2
10
11
  platform: ruby
11
12
  authors:
12
13
  - Steven Rushe
@@ -15,8 +16,7 @@ autorequire:
15
16
  bindir: bin
16
17
  cert_chain: []
17
18
 
18
- date: 2011-04-12 00:00:00 +01:00
19
- default_executable:
19
+ date: 2011-04-13 00:00:00 Z
20
20
  dependencies: []
21
21
 
22
22
  description: A library for validating uk postcodes
@@ -34,7 +34,12 @@ files:
34
34
  - lib/rails3.rb
35
35
  - lib/validates_as_uk_postcode.rb
36
36
  - README.mdown
37
- has_rdoc: true
37
+ - test/rails2/models/abstract_model.rb
38
+ - test/rails2/test_helper.rb
39
+ - test/rails2/validates_as_uk_postcode_test.rb
40
+ - test/rails3/models/abstract_model.rb
41
+ - test/rails3/test_helper.rb
42
+ - test/rails3/validates_as_uk_postcode_test.rb
38
43
  homepage: http://github.com/davidjrice/validates_as_uk_postcode
39
44
  licenses: []
40
45
 
@@ -44,23 +49,27 @@ rdoc_options:
44
49
  require_paths:
45
50
  - lib
46
51
  required_ruby_version: !ruby/object:Gem::Requirement
52
+ none: false
47
53
  requirements:
48
54
  - - ">="
49
55
  - !ruby/object:Gem::Version
56
+ hash: 3
50
57
  segments:
51
58
  - 0
52
59
  version: "0"
53
60
  required_rubygems_version: !ruby/object:Gem::Requirement
61
+ none: false
54
62
  requirements:
55
63
  - - ">="
56
64
  - !ruby/object:Gem::Version
65
+ hash: 3
57
66
  segments:
58
67
  - 0
59
68
  version: "0"
60
69
  requirements: []
61
70
 
62
71
  rubyforge_project:
63
- rubygems_version: 1.3.6
72
+ rubygems_version: 1.7.2
64
73
  signing_key:
65
74
  specification_version: 3
66
75
  summary: Validates a field is a valid UK postcode