countries 0.1.2 → 0.1.3

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.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/countries.gemspec +1 -1
  3. data/lib/countries.rb +4 -3
  4. metadata +1 -1
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{countries}
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["hexorx"]
@@ -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.open("lib/data/subdivisions/#{alpha2}.yaml") {|yaml| YAML::load( yaml )} : {}
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?("lib/data/subdivisions/#{alpha2}.yaml")
40
+ File.exist?(File.join(File.dirname(__FILE__), 'data', 'subdivisions', "#{alpha2}.yaml"))
40
41
  end
41
42
  end
42
43
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: countries
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - hexorx