worlddb 2.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/worlddb/matcher.rb +8 -1
- data/lib/worlddb/version.rb +2 -1
- data/test/test_fixture_matchers.rb +2 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59d359324b74a98a439db685262ac19f45b9b4fd
|
4
|
+
data.tar.gz: f365f7d48a5b8c231c6360619277198474946987
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6af0ffb930e7adf561101da121a8b34e94155f50426a46b5a267a40769e2447f628ced943a97b1fbbf6711640a542dac9bd9af98845e43ca1605bb01358027e8
|
7
|
+
data.tar.gz: 3a4652518bcde53b53b6024b9c7cba9347b02cd3dc9d7d1ec18dbe4d14cf57d7e72a5c2970c7a020284dab17bea0e083b9ea3409b741815fdf4b09e67d072351
|
data/lib/worlddb/matcher.rb
CHANGED
@@ -11,10 +11,14 @@ module Matcher
|
|
11
11
|
# note: allow /cities and /1--hokkaido--cities
|
12
12
|
xxx_pattern = "(?:#{xxx}|[0-9]+--[^\\/]+?--#{xxx})" # note: double escape \\ required for backslash
|
13
13
|
|
14
|
+
##
|
15
|
+
## todo: add $-anchor at the end of pattern - why? why not?? (will include .txt or .yaml??)
|
16
|
+
|
14
17
|
if name =~ /(?:^|\/)([a-z]{2,3})-[^\/]+\/#{xxx_pattern}/ || # (1)
|
15
18
|
name =~ /(?:^|\/)[0-9]+--([a-z]{2,3})-[^\/]+\/#{xxx_pattern}/ || # (2)
|
16
19
|
name =~ /(?:^|\/)([a-z]{2,3})\/#{xxx_pattern}/ || # (3)
|
17
|
-
name =~ /(?:^|\/)([a-z]{2,3})-[^\/]+\/[0-9]+--[^\/]+\/#{xxx_pattern}/
|
20
|
+
name =~ /(?:^|\/)([a-z]{2,3})-[^\/]+\/[0-9]+--[^\/]+\/#{xxx_pattern}/ || # (4)
|
21
|
+
name =~ /(?:^|\/)([a-z]{2,3})-[^\/]+--#{xxx}/ # (5)
|
18
22
|
|
19
23
|
country_key = $1.dup
|
20
24
|
yield( country_key )
|
@@ -28,6 +32,9 @@ module Matcher
|
|
28
32
|
# (3) classic style: e.g. /at/beers (europe/at/cities)
|
29
33
|
#
|
30
34
|
# (4) new style w/ region w/o abbrev/code e.g. /ja-japon/1--hokkaido/cities
|
35
|
+
#
|
36
|
+
# (5) compact style (country part of filename):
|
37
|
+
# e.g. /at-austria--cities or /europe/at-austria--cities
|
31
38
|
else
|
32
39
|
false # no match found
|
33
40
|
end
|
data/lib/worlddb/version.rb
CHANGED
@@ -33,6 +33,7 @@ class TestFixtureMatchers < MiniTest::Unit::TestCase
|
|
33
33
|
beers_at = [
|
34
34
|
'europe/at/beers',
|
35
35
|
'europe/at-austria/beers',
|
36
|
+
'europe/at-austria--beers',
|
36
37
|
'at-austria/beers',
|
37
38
|
'at-austria!/beers',
|
38
39
|
'1--at-austria--central/beers',
|
@@ -48,7 +49,7 @@ class TestFixtureMatchers < MiniTest::Unit::TestCase
|
|
48
49
|
found = match_xxx_for_country( name, 'beers' ) do |country_key|
|
49
50
|
assert_equal country_key, 'at'
|
50
51
|
end
|
51
|
-
assert found
|
52
|
+
assert found, "no match found for '#{name}'"
|
52
53
|
end
|
53
54
|
|
54
55
|
breweries_at = [
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: worlddb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: props
|
@@ -114,14 +114,14 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - ~>
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '3.
|
117
|
+
version: '3.10'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - ~>
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '3.
|
124
|
+
version: '3.10'
|
125
125
|
description: worlddb - world.db command line tool
|
126
126
|
email: openmundi@googlegroups.com
|
127
127
|
executables:
|
@@ -200,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
200
200
|
- !ruby/object:Gem::Version
|
201
201
|
version: '0'
|
202
202
|
requirements: []
|
203
|
-
rubyforge_project:
|
203
|
+
rubyforge_project:
|
204
204
|
rubygems_version: 2.1.10
|
205
205
|
signing_key:
|
206
206
|
specification_version: 4
|