regional 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 92ca6c0a9ea4d63e6c7997fcf9ffc947395082ad
4
- data.tar.gz: ae05934e3d9ffaf5e1b51c158c96061e5e66b01b
3
+ metadata.gz: 8e56f497c7d6266cacc96ab0624b57ecdf8214c2
4
+ data.tar.gz: 09c57da333a7c637a4182814d791398d7e4a04b3
5
5
  SHA512:
6
- metadata.gz: 8ef941e925059cf5ffb7a2b732972c8c5721f3b1bff10934d428ae730fcd208efbf46cf2e94ea556be285e40d6723dcb7587bb0265e54687b43ee8c00fef5360
7
- data.tar.gz: 5947eb692989ebf6dee865b2e77947a94cf8c5cd63c10a1696fea8580985bb882380b9fde8d13b806e6717001dd5527c3fd56a68651f8bce1e032307635fa379
6
+ metadata.gz: 3764f6b9cea8ac9e8a2e4a4fdef490d2aac0e9c4544081c88de31fdae4fdf72d66b133685fcb0663e2ac261de389bb8dab6f820b3f4d3343ec5aacd9767d3690
7
+ data.tar.gz: ce4c4bb151d229c8244b735b6fd9bed84642e78e450a8f13c3c846a113a32ad3dae8c8a0675e6887c22bca086b4ac1348a2859a78ca0ed836621dd0c1c36b2da
@@ -30,5 +30,10 @@ Feature: Determine whether postal code is in range
30
30
 
31
31
  Scenario: No range
32
32
  Given the zone is ""
33
+ Then H0H 0H0 should not be included
34
+ Then V1A 0B3 should not be included
35
+
36
+ Scenario: Everywhere
37
+ Given the zone is "*"
33
38
  Then H0H 0H0 should be included
34
- Then V1A 0B3 should be included
39
+ Then T1A 2P4 should be included
@@ -18,9 +18,22 @@ Feature: Understand Canadian postal codes
18
18
  | A1A 1AA |
19
19
  | 1A1 A1A |
20
20
 
21
- Scenario: Gibberish
22
- When I enter postal code BOB LOBLAW
23
- Then it is an error
21
+ Scenario Outline: Gibberish
22
+ When I enter postal code <input>
23
+ Then it's an error
24
+
25
+ Examples:
26
+ | input |
27
+ | BOB LOBLAW |
28
+ | U*FOO |
29
+ | foofooo |
30
+ | JP1 DDD |
31
+ | GGGGgg! |
32
+ | ++++ |
33
+ | Marcel |
34
+ | Leboeuf |
35
+ | 0 |
36
+ | J7Y |
24
37
 
25
38
  Scenario Outline: Forbidden letters
26
39
  When I enter postal code <input>
@@ -1,3 +1,3 @@
1
1
  module Regional
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -2,7 +2,12 @@ module Regional
2
2
  class Zone
3
3
  attr_reader :components
4
4
 
5
+ # Make a zone of included ranges. A value of +nil+ means nowhere.
6
+ # +"*"+ means _everywhere_. Literally _everywhere_.
5
7
  def initialize(zone)
8
+ return unless zone
9
+ return @components = ["0".."ZZZZZZ"] if zone == "*"
10
+
6
11
  @components = zone.split(/,\s*/).map do |str|
7
12
  array = str.split("-")
8
13
 
@@ -14,8 +19,6 @@ module Regional
14
19
  raise ArgumentError, "Range can only have one hyphen"
15
20
  end
16
21
  end
17
-
18
- @components[0] ||= "0".."ZZZZZZ"
19
22
  end
20
23
 
21
24
  def cover?(area)
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["jonathan@allard.io"]
11
11
  spec.description = %q{Regional allows defining regions and testing what's inside it.}
12
12
  spec.summary = spec.description
13
- spec.homepage = ""
13
+ spec.homepage = "https://github.com/joallard/regional"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: regional
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Allard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-25 00:00:00.000000000 Z
11
+ date: 2013-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -103,7 +103,7 @@ files:
103
103
  - lib/regional/version.rb
104
104
  - lib/regional/zone.rb
105
105
  - regional.gemspec
106
- homepage: ''
106
+ homepage: https://github.com/joallard/regional
107
107
  licenses:
108
108
  - MIT
109
109
  metadata: {}