countries 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/countries.gemspec +1 -1
- data/lib/countries.rb +4 -3
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
data/countries.gemspec
CHANGED
data/lib/countries.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
class Country
|
2
|
-
Data = File.open( 'lib/data/countries.yaml' ) {|yaml| YAML::load( yaml )}
|
2
|
+
#Data = File.open( 'lib/data/countries.yaml' ) {|yaml| YAML::load( yaml )}
|
3
|
+
Data = YAML.load_file(File.join(File.dirname(__FILE__), 'data', 'countries.yaml')) || {}
|
3
4
|
Names = Data.map {|code,data| data[:name]}
|
4
5
|
|
5
6
|
attr_reader :number, :alpha2, :alpha3, :name, :names, :latitude, :longitude, :region, :subregion, :country_code, :national_destination_code_lengths, :national_number_lengths, :international_prefix, :national_prefix
|
@@ -32,11 +33,11 @@ class Country
|
|
32
33
|
end
|
33
34
|
|
34
35
|
def subdivisions
|
35
|
-
@subdivisions ||= subdivisions? ? File.
|
36
|
+
@subdivisions ||= subdivisions? ? YAML.load_file(File.join(File.dirname(__FILE__), 'data', 'subdivisions', "#{alpha2}.yaml")) : {}
|
36
37
|
end
|
37
38
|
|
38
39
|
def subdivisions?
|
39
|
-
File.exist?(
|
40
|
+
File.exist?(File.join(File.dirname(__FILE__), 'data', 'subdivisions', "#{alpha2}.yaml"))
|
40
41
|
end
|
41
42
|
end
|
42
43
|
|