uncharted 0.0.7.beta1 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -19,21 +19,24 @@ module Uncharted
19
19
  countries.count
20
20
  end
21
21
 
22
- def self.find(codes)
23
- if codes.is_a? Array
24
- return codes.collect {|c| data[c]}
22
+ def self.find(objects)
23
+ case objects
24
+ when Array
25
+ objects.collect {|c| data[c]}
26
+ when Country
27
+ objects
28
+ else
29
+ data[objects]
25
30
  end
26
- data[codes]
27
31
  end
28
32
 
29
33
  def self.countries
30
34
  @data.values
31
35
  end
32
-
36
+
33
37
  def self.data
34
38
  @data ||= {}
35
39
  end
36
-
37
40
 
38
41
  end
39
42
 
@@ -48,8 +48,8 @@ module Uncharted
48
48
  @abbr
49
49
  end
50
50
 
51
- def self.find(code)
52
- data[code]
51
+ def self.find(object)
52
+ object.is_a?(Territory) ? object : data[object]
53
53
  end
54
54
 
55
55
  def self.data
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Uncharted
3
- VERSION = '0.0.7.beta1'
3
+ VERSION = '0.0.8'
4
4
  end
data/test/country_test.rb CHANGED
@@ -19,6 +19,7 @@ class TestCountry < MiniTest::Unit::TestCase
19
19
  def test_country_find
20
20
  @us = Country.find('US')
21
21
  assert_equal [@br, @us], Country.find([@br.alpha2, @us.alpha2])
22
+ assert_equal @us, Country.find(@us)
22
23
  end
23
24
 
24
25
  def test_to_s
data/test/test_helper.rb CHANGED
@@ -2,15 +2,15 @@
2
2
  gem 'minitest'
3
3
 
4
4
  require 'simplecov' # Must be included 1st
5
+
5
6
  require 'minitest/autorun'
6
7
  require 'purdytest'
7
-
8
- require 'simplecov-rcov-text'
8
+ require 'simplecov-rcov'
9
9
 
10
10
  class SimpleCov::Formatter::MergedFormatter
11
11
  def format(result)
12
12
  SimpleCov::Formatter::HTMLFormatter.new.format(result)
13
- SimpleCov::Formatter::RcovTextFormatter.new.format(result)
13
+ SimpleCov::Formatter::RcovFormatter.new.format(result)
14
14
  end
15
15
  end
16
16
 
data/uncharted.gemspec CHANGED
@@ -21,8 +21,10 @@ Gem::Specification.new do |s|
21
21
 
22
22
  s.required_ruby_version = '>= 1.9'
23
23
 
24
- s.add_development_dependency 'minitest' # minitest latest gem
25
- s.add_development_dependency 'purdytest' # colored tests for minitest https://github.com/tenderlove/purdytest
26
- s.add_development_dependency 'yard' # Doc generator
24
+ s.add_development_dependency 'minitest' # minitest latest gem
25
+ s.add_development_dependency 'purdytest' # colored tests for minitest https://github.com/tenderlove/purdytest
26
+ s.add_development_dependency 'simplecov'
27
+ s.add_development_dependency 'simplecov-rcov'
28
+ s.add_development_dependency 'yard' # Doc generator
27
29
 
28
30
  end
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uncharted
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7.beta1
5
- prerelease: 6
4
+ version: 0.0.8
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Gilson Ferraz
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-05 00:00:00.000000000Z
12
+ date: 2011-10-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest
16
- requirement: &2160168080 !ruby/object:Gem::Requirement
16
+ requirement: &2156459540 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *2160168080
24
+ version_requirements: *2156459540
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: purdytest
27
- requirement: &2160155840 !ruby/object:Gem::Requirement
27
+ requirement: &2156458620 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,32 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2160155840
35
+ version_requirements: *2156458620
36
+ - !ruby/object:Gem::Dependency
37
+ name: simplecov
38
+ requirement: &2156457820 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *2156457820
47
+ - !ruby/object:Gem::Dependency
48
+ name: simplecov-rcov
49
+ requirement: &2156716040 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *2156716040
36
58
  - !ruby/object:Gem::Dependency
37
59
  name: yard
38
- requirement: &2160143640 !ruby/object:Gem::Requirement
60
+ requirement: &2156715280 !ruby/object:Gem::Requirement
39
61
  none: false
40
62
  requirements:
41
63
  - - ! '>='
@@ -43,7 +65,7 @@ dependencies:
43
65
  version: '0'
44
66
  type: :development
45
67
  prerelease: false
46
- version_requirements: *2160143640
68
+ version_requirements: *2156715280
47
69
  description: Provide ISO 3166 codes and english name for countries and their political
48
70
  divisions
49
71
  email:
@@ -87,12 +109,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
87
109
  required_rubygems_version: !ruby/object:Gem::Requirement
88
110
  none: false
89
111
  requirements:
90
- - - ! '>'
112
+ - - ! '>='
91
113
  - !ruby/object:Gem::Version
92
- version: 1.3.1
114
+ version: '0'
93
115
  requirements: []
94
116
  rubyforge_project:
95
- rubygems_version: 1.8.10
117
+ rubygems_version: 1.8.6
96
118
  signing_key:
97
119
  specification_version: 3
98
120
  summary: ISO 3166 Countries & territories codes (NOT READY FOR USE YET!)
@@ -101,3 +123,4 @@ test_files:
101
123
  - test/mongoid_test.rb
102
124
  - test/test_helper.rb
103
125
  - test/uncharted_test.rb
126
+ has_rdoc: