worlddb 1.8.0 → 1.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/worlddb/matcher.rb +15 -2
- data/lib/worlddb/version.rb +1 -1
- data/test/test_fixture_matchers.rb +5 -1
- metadata +11 -11
data/lib/worlddb/matcher.rb
CHANGED
@@ -27,8 +27,10 @@ module Matcher
|
|
27
27
|
|
28
28
|
def match_xxx_for_country_n_region( name, xxx ) # xxx e.g. beers|breweries
|
29
29
|
# auto-add required country n region code (from folder structure)
|
30
|
-
if name =~ /(?:^|\/)([a-z]{2,3})-[^\/]+\/([a-z]{1,3})-[^\/]+\/#{xxx}/ ||
|
31
|
-
name =~ /(?:^|\/)[0-9]+--([a-z]{2,3})-[^\/]+\/[0-9]+--([a-z]{1,3})-[^\/]+\/#{xxx}/
|
30
|
+
if name =~ /(?:^|\/)([a-z]{2,3})-[^\/]+\/([a-z]{1,3})-[^\/]+\/#{xxx}/ || # (1)
|
31
|
+
name =~ /(?:^|\/)[0-9]+--([a-z]{2,3})-[^\/]+\/[0-9]+--([a-z]{1,3})-[^\/]+\/#{xxx}/ || # (2)
|
32
|
+
name =~ /(?:^|\/)([a-z]{2,3})-[^\/]+\/[0-9]+--([a-z]{1,3})-[^\/]+\/#{xxx}/ || # (3)
|
33
|
+
name =~ /(?:^|\/)[0-9]+--([a-z]{2,3})-[^\/]+\/([a-z]{1,3})-[^\/]+\/#{xxx}/ # (4)
|
32
34
|
|
33
35
|
#######
|
34
36
|
# nb: country must start name (^) or coming after / e.g. europe/at-austria/...
|
@@ -37,6 +39,14 @@ module Matcher
|
|
37
39
|
# ^at-austria!/w-wien/beers
|
38
40
|
# (2)
|
39
41
|
# new new style e.g. /1--at-austria--central/1--w-wien--eastern/beers
|
42
|
+
#
|
43
|
+
# (3)
|
44
|
+
# new new mixed style e.g. /at-austria/1--w-wien--eastern/beers
|
45
|
+
# "classic" country plus new new region
|
46
|
+
#
|
47
|
+
# (4)
|
48
|
+
# new new mixed style e.g. /1--at-austria--central/w-wien/beers
|
49
|
+
# new new country plus "classic" region
|
40
50
|
|
41
51
|
country_key = $1.dup
|
42
52
|
region_key = $2.dup
|
@@ -50,6 +60,9 @@ module Matcher
|
|
50
60
|
|
51
61
|
def match_cities_for_country( name, &blk )
|
52
62
|
## todo: check if there's a better (more ruby way) to pass along code block ??
|
63
|
+
## e.g. try
|
64
|
+
## match_xxx_for_country( name, 'cities') { |country_key| yield(country_key) }
|
65
|
+
|
53
66
|
match_xxx_for_country( name, 'cities', &blk )
|
54
67
|
end
|
55
68
|
|
data/lib/worlddb/version.rb
CHANGED
@@ -66,7 +66,11 @@ class TestFixtureMatchers < MiniTest::Unit::TestCase
|
|
66
66
|
'at-austria/w-wien/beers',
|
67
67
|
'at-austria!/w-wien/beers',
|
68
68
|
'1--at-austria--central/1--w-wien--eastern/beers',
|
69
|
-
'europe/1--at-austria--central/1--w-wien--eastern/beers'
|
69
|
+
'europe/1--at-austria--central/1--w-wien--eastern/beers',
|
70
|
+
'at-austria/1--w-wien--eastern/beers',
|
71
|
+
'europe/at-austria!/1--w-wien--eastern/beers',
|
72
|
+
'1--at-austria--central/w-wien/beers',
|
73
|
+
'europe/1--at-austria--central/w-wien/beers'
|
70
74
|
]
|
71
75
|
|
72
76
|
beers_at.each do |name|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: worlddb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2014-01-17 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: textutils
|
16
|
-
requirement: &
|
16
|
+
requirement: &20570436 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0.6'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *20570436
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: commander
|
27
|
-
requirement: &
|
27
|
+
requirement: &20570136 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 4.1.3
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *20570136
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: activerecord
|
38
|
-
requirement: &
|
38
|
+
requirement: &20569776 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '3.2'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *20569776
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rdoc
|
49
|
-
requirement: &
|
49
|
+
requirement: &20569236 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '4.0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *20569236
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: hoe
|
60
|
-
requirement: &
|
60
|
+
requirement: &20568840 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '3.7'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *20568840
|
69
69
|
description: worlddb - world.db command line tool
|
70
70
|
email: openmundi@googlegroups.com
|
71
71
|
executables:
|