worlddb-compat 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Manifest.txt +6 -0
- data/lib/worlddb/compat.rb +7 -0
- data/lib/worlddb/compat/city.rb +29 -0
- data/lib/worlddb/compat/continent.rb +24 -0
- data/lib/worlddb/compat/country.rb +36 -0
- data/lib/worlddb/compat/lang.rb +23 -0
- data/lib/worlddb/compat/matcher.rb +32 -0
- data/lib/worlddb/compat/state.rb +30 -0
- data/lib/worlddb/compat/version.rb +2 -2
- metadata +7 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 926061dc85aa36f8525eb902c5f277db79b0b2d4
|
4
|
+
data.tar.gz: 21c215213c7058dce3964ba052d1b268a3ce3abf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f26476c20c8f2a6048750ed6f4cca9ce7baafa295207629b2859d93d122bdcf1079ee01b1721de5fac9d996eabbf52e07a729209bebc9fe4b8209c925b41b2b
|
7
|
+
data.tar.gz: 20acdcbb6928314af9a3636b71e12ed963d6404ea677697cb19ab787fdd8fdc3681a11e03cf68e004c98e86c54f464d8dac23e4595735480712fd179840b9c30
|
data/Manifest.txt
CHANGED
@@ -3,4 +3,10 @@ Manifest.txt
|
|
3
3
|
README.md
|
4
4
|
Rakefile
|
5
5
|
lib/worlddb/compat.rb
|
6
|
+
lib/worlddb/compat/city.rb
|
7
|
+
lib/worlddb/compat/continent.rb
|
8
|
+
lib/worlddb/compat/country.rb
|
9
|
+
lib/worlddb/compat/lang.rb
|
10
|
+
lib/worlddb/compat/matcher.rb
|
11
|
+
lib/worlddb/compat/state.rb
|
6
12
|
lib/worlddb/compat/version.rb
|
data/lib/worlddb/compat.rb
CHANGED
@@ -6,6 +6,13 @@
|
|
6
6
|
|
7
7
|
require 'worlddb/compat/version' # always goes first
|
8
8
|
|
9
|
+
require 'worlddb/compat/city'
|
10
|
+
require 'worlddb/compat/continent'
|
11
|
+
require 'worlddb/compat/country'
|
12
|
+
require 'worlddb/compat/lang'
|
13
|
+
require 'worlddb/compat/state'
|
14
|
+
|
15
|
+
require 'worlddb/compat/matcher'
|
9
16
|
|
10
17
|
|
11
18
|
# say hello
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module WorldDb
|
4
|
+
module Model
|
5
|
+
|
6
|
+
#############################################################
|
7
|
+
# collect depreciated or methods for future removal here
|
8
|
+
# - keep for now for commpatibility (for old code)
|
9
|
+
|
10
|
+
class City
|
11
|
+
|
12
|
+
def title() name; end
|
13
|
+
def title=(value) self.name = value; end
|
14
|
+
|
15
|
+
scope :by_title, ->{ order( 'name asc' ) } # order by title (a-z)
|
16
|
+
|
17
|
+
|
18
|
+
def synonyms() alt_names; end
|
19
|
+
def synonyms=(value) self.alt_names = value; end
|
20
|
+
|
21
|
+
def title_w_synonyms( opts={} ) all_names( opts ); end # depreciated: use all_names instead
|
22
|
+
|
23
|
+
belongs_to :region, class_name: 'State', foreign_key: 'state_id'
|
24
|
+
|
25
|
+
end # class Cities
|
26
|
+
|
27
|
+
end # module Model
|
28
|
+
end # module WorldDb
|
29
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module WorldDb
|
4
|
+
module Model
|
5
|
+
|
6
|
+
#############################################################
|
7
|
+
# collect depreciated or methods for future removal here
|
8
|
+
# - keep for now for commpatibility (for old code)
|
9
|
+
|
10
|
+
class Continent
|
11
|
+
|
12
|
+
def title() name; end
|
13
|
+
def title=(value) self.name = value; end
|
14
|
+
|
15
|
+
scope :by_title, ->{ order( 'name asc' ) } # order by title (a-z)
|
16
|
+
|
17
|
+
def synonyms() alt_names; end
|
18
|
+
def synonyms=(value) self.alt_names = value; end
|
19
|
+
|
20
|
+
end # class Continent
|
21
|
+
|
22
|
+
|
23
|
+
end # module Model
|
24
|
+
end # module WorldDb
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module WorldDb
|
4
|
+
module Model
|
5
|
+
|
6
|
+
#############################################################
|
7
|
+
# collect depreciated or methods for future removal here
|
8
|
+
# - keep for now for commpatibility (for old code)
|
9
|
+
|
10
|
+
|
11
|
+
class Country
|
12
|
+
|
13
|
+
def title() name; end
|
14
|
+
def title=(value) self.name = value; end
|
15
|
+
|
16
|
+
scope :by_title, ->{ order( 'name asc' ) } # order by title (a-z)
|
17
|
+
|
18
|
+
def iso2() alpha2; end
|
19
|
+
def iso2=(value) self.alpha2 = value; end
|
20
|
+
|
21
|
+
def iso3() alpha3; end
|
22
|
+
def iso3=(value) self.alpha3 = value; end
|
23
|
+
|
24
|
+
|
25
|
+
def synonyms() alt_names; end
|
26
|
+
def synonyms=(value) self.alt_names = value; end
|
27
|
+
|
28
|
+
def title_w_synonyms( opts={} ) all_names( opts ); end # depreciated: use all_names instead
|
29
|
+
|
30
|
+
has_many :regions, class_name: 'State', foreign_key: 'state_id'
|
31
|
+
|
32
|
+
end # class Country
|
33
|
+
|
34
|
+
end # module Model
|
35
|
+
end # module WorldDb
|
36
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module WorldDb
|
4
|
+
module Model
|
5
|
+
|
6
|
+
#############################################################
|
7
|
+
# collect depreciated or methods for future removal here
|
8
|
+
# - keep for now for commpatibility (for old code)
|
9
|
+
|
10
|
+
|
11
|
+
class Lang
|
12
|
+
|
13
|
+
#####################################################
|
14
|
+
# alias for name (remove! add depreciated api call ???)
|
15
|
+
def title() name; end
|
16
|
+
def title=(value) self.name = value; end
|
17
|
+
|
18
|
+
scope :by_title, ->{ order( 'name asc' ) } # order by title (a-z)
|
19
|
+
|
20
|
+
end # class Lang
|
21
|
+
|
22
|
+
end # module Model
|
23
|
+
end # module WorldDb
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
module WorldDb
|
4
|
+
|
5
|
+
module Matcher
|
6
|
+
|
7
|
+
#####################################
|
8
|
+
## compat - remove later!!!
|
9
|
+
def match_xxx_for_country_n_region( name, xxx )
|
10
|
+
match_xxx_for_country_n_state( name, xxx )
|
11
|
+
end
|
12
|
+
|
13
|
+
def match_regions_for_country( name, &blk )
|
14
|
+
match_states_for_country( name, &blk )
|
15
|
+
end
|
16
|
+
|
17
|
+
def match_regions_abbr_for_country( name, &blk ) # NB: . gets escaped for regex, that is, \.
|
18
|
+
match_states_abbr_for_country( name, &blk )
|
19
|
+
end
|
20
|
+
|
21
|
+
def match_regions_iso_for_country( name, &blk ) # NB: . gets escaped for regex, that is, \.
|
22
|
+
match_states_iso_for_country( name, &blk )
|
23
|
+
end
|
24
|
+
|
25
|
+
def match_regions_nuts_for_country( name, &blk ) # NB: . gets escaped for regex, that is, \.
|
26
|
+
match_states_nuts_for_country( name, &blk )
|
27
|
+
end
|
28
|
+
|
29
|
+
end # module Matcher
|
30
|
+
|
31
|
+
end # module WorldDb
|
32
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module WorldDb
|
4
|
+
module Model
|
5
|
+
|
6
|
+
#############################################################
|
7
|
+
# collect depreciated or methods for future removal here
|
8
|
+
# - keep for now for commpatibility (for old code)
|
9
|
+
|
10
|
+
class State
|
11
|
+
|
12
|
+
def title() name; end
|
13
|
+
def title=(value) self.name = value; end
|
14
|
+
|
15
|
+
scope :by_title, ->{ order( 'name asc' ) } # order by title (a-z)
|
16
|
+
|
17
|
+
def synonyms() alt_names; end
|
18
|
+
def synonyms=(value) self.alt_names = value; end
|
19
|
+
|
20
|
+
def title_w_synonyms( opts={} ) all_names( opts ); end # depreciated: use all_names instead
|
21
|
+
|
22
|
+
has_many :regions, class_name: 'State', foreign_key: 'state_id' ## subregions
|
23
|
+
|
24
|
+
end # class State
|
25
|
+
|
26
|
+
### add "old" alias for State class
|
27
|
+
Region = State
|
28
|
+
|
29
|
+
end # module Model
|
30
|
+
end # module WorldDb
|
@@ -4,8 +4,8 @@ module WorldDbCompat
|
|
4
4
|
|
5
5
|
# sync version w/ world.db n friends - why? why not?
|
6
6
|
MAJOR = 0 ## todo: namespace inside version or something - why? why not??
|
7
|
-
MINOR =
|
8
|
-
PATCH =
|
7
|
+
MINOR = 1
|
8
|
+
PATCH = 0
|
9
9
|
VERSION = [MAJOR,MINOR,PATCH].join('.')
|
10
10
|
|
11
11
|
def self.version
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: worlddb-compat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
@@ -66,6 +66,12 @@ files:
|
|
66
66
|
- README.md
|
67
67
|
- Rakefile
|
68
68
|
- lib/worlddb/compat.rb
|
69
|
+
- lib/worlddb/compat/city.rb
|
70
|
+
- lib/worlddb/compat/continent.rb
|
71
|
+
- lib/worlddb/compat/country.rb
|
72
|
+
- lib/worlddb/compat/lang.rb
|
73
|
+
- lib/worlddb/compat/matcher.rb
|
74
|
+
- lib/worlddb/compat/state.rb
|
69
75
|
- lib/worlddb/compat/version.rb
|
70
76
|
homepage: https://github.com/worlddb/world.db.compat
|
71
77
|
licenses:
|