worldlite 0.0.1 → 0.0.2
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.
- data/.gemtest +0 -0
- data/Manifest.txt +4 -0
- data/README.md +2 -1
- data/lib/worldlite.rb +4 -0
- data/lib/worldlite/country.rb +46 -0
- data/lib/worldlite/europe/at_austria.rb +27 -0
- data/lib/worldlite/version.rb +1 -1
- data/test/helper.rb +9 -0
- data/test/test_world.rb +19 -0
- metadata +13 -7
data/.gemtest
ADDED
File without changes
|
data/Manifest.txt
CHANGED
data/README.md
CHANGED
data/lib/worldlite.rb
CHANGED
@@ -0,0 +1,46 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module WorldLite
|
4
|
+
|
5
|
+
|
6
|
+
WORLD = [] ## ary holds all countries; same as Country.all
|
7
|
+
WORLD_UN = [] ## ary holds 193 un (united nations) countries
|
8
|
+
WORLD_ISO = [] ## ary holds 2?? iso countries
|
9
|
+
WORLD_FIFA = [] ## ary hold 2?? fifa countries
|
10
|
+
|
11
|
+
EUROPE = [] ## ary holds un countries (from europe)
|
12
|
+
EUROPE_UEFA = [] ## ary holds 54 uefa countries
|
13
|
+
EUROPE_EU = [] ## ary holds european union countries (from europe)
|
14
|
+
EUROPE_EURO = [] ## ary holds european euro countries (from europe)
|
15
|
+
|
16
|
+
|
17
|
+
class Country
|
18
|
+
|
19
|
+
attr_accessor :name, # country name e.g. Austria
|
20
|
+
:key, # key (iso alpha2 if available - otherwise alpha3)
|
21
|
+
:num, # iso numeric code e.g. 021
|
22
|
+
:alpha2, # iso alpha2 code e.g. AT
|
23
|
+
:alpha3, # iso alpha3 code e.g. AUT
|
24
|
+
:fifa, # fifa (football) code
|
25
|
+
:ioc, # ioc (olympics) code
|
26
|
+
:un, # un (united nations) flag member (true|false)
|
27
|
+
:kind # CTRY|DEPY|SUPR (country|dependency|supranational) - add other?
|
28
|
+
|
29
|
+
### :slug, # e.g. at-austria ## todo - auto-calculate e.g. alpha2 + name ??
|
30
|
+
|
31
|
+
|
32
|
+
def initialize
|
33
|
+
@kind = 'CTRY' # default to 'sovereign' country - why? why not?
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
def self.all
|
38
|
+
## return all countries as an ary e.g. use Country.all
|
39
|
+
WORLD
|
40
|
+
end
|
41
|
+
|
42
|
+
end # class Country
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
end # module WorldLite
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module WorldLite
|
4
|
+
|
5
|
+
c = Country.new
|
6
|
+
c.name = 'Austria'
|
7
|
+
c.key = 'at'
|
8
|
+
c.num = 021 # check if leading zero leads to octal num system?? just use 21 ??
|
9
|
+
c.alpha2 = 'at'
|
10
|
+
c.alpha3 = 'aut'
|
11
|
+
c.fifa = 'aut'
|
12
|
+
c.ioc = 'aut'
|
13
|
+
c.un = true
|
14
|
+
|
15
|
+
AT = c
|
16
|
+
|
17
|
+
WORLD << AT ## add to world ary
|
18
|
+
WORLD_UN << AT
|
19
|
+
WORLD_ISO << AT
|
20
|
+
WORLD_FIFA << AT
|
21
|
+
|
22
|
+
EUROPE << AT
|
23
|
+
EUROPE_UEFA << AT
|
24
|
+
EUROPE_EU << AT
|
25
|
+
EUROPE_EURO << AT
|
26
|
+
|
27
|
+
end # module WorldLite
|
data/lib/worldlite/version.rb
CHANGED
data/test/helper.rb
ADDED
data/test/test_world.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'helper'
|
4
|
+
|
5
|
+
|
6
|
+
class TestWorld < Minitest::Test
|
7
|
+
|
8
|
+
include WorldLite # e.g. use WORLD, AT, etc.
|
9
|
+
|
10
|
+
def test_world
|
11
|
+
assert_equal 1, WORLD.size
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_at
|
15
|
+
assert_equal 'Austria', AT.name
|
16
|
+
assert_equal 'at', AT.key
|
17
|
+
end
|
18
|
+
|
19
|
+
end # class TestWorld
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: worldlite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2014-08-19 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rdoc
|
16
|
-
requirement: &
|
16
|
+
requirement: &72024000 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,18 +21,18 @@ dependencies:
|
|
21
21
|
version: '4.0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *72024000
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: hoe
|
27
|
-
requirement: &
|
27
|
+
requirement: &72023700 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '3.
|
32
|
+
version: '3.12'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *72023700
|
36
36
|
description: worldlite - country data (lightweight - all data included as good ol'
|
37
37
|
ruby code - no database, no dependencies)
|
38
38
|
email: openmundi@googlegroups.com
|
@@ -48,7 +48,12 @@ files:
|
|
48
48
|
- README.md
|
49
49
|
- Rakefile
|
50
50
|
- lib/worldlite.rb
|
51
|
+
- lib/worldlite/country.rb
|
52
|
+
- lib/worldlite/europe/at_austria.rb
|
51
53
|
- lib/worldlite/version.rb
|
54
|
+
- test/helper.rb
|
55
|
+
- test/test_world.rb
|
56
|
+
- .gemtest
|
52
57
|
homepage: https://github.com/worlddb/world.lite.ruby
|
53
58
|
licenses:
|
54
59
|
- Public Domain
|
@@ -77,4 +82,5 @@ signing_key:
|
|
77
82
|
specification_version: 3
|
78
83
|
summary: worldlite - country data (lightweight - all data included as good ol' ruby
|
79
84
|
code - no database, no dependencies)
|
80
|
-
test_files:
|
85
|
+
test_files:
|
86
|
+
- test/test_world.rb
|