brasil-estados 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/brasil-estados/estado.rb +14 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc106892731e28c4ea7a23dbe768df5e72b30c2a
|
4
|
+
data.tar.gz: 4fb269f0b9fa0b0025cab2cb88d277d42e8a2434
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc3e57d9ede2a588aa142303a99390d1ff08191c0d4e3e551bd0515c36c940a79ef1886fcd7a9bb8829e5c36e4c2db1ec35af66857dac929215817b96e7548a4
|
7
|
+
data.tar.gz: 71ce20501b7ac00ec63eb2e12afeb5bd7a6070615feffc7e11c23fd2c21c767463170d3bd4e61510f2d13687f925627eec9ffc85b3672d6750ed6ed33994c1de
|
@@ -26,7 +26,16 @@ module Brasil
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
estados
|
29
|
+
raise ArgumentError, "Not a valid regiao" if estados.empty?
|
30
|
+
raise ArgumentError, "Invalid information requested" if !valid_info?(info_requested)
|
31
|
+
|
32
|
+
return estados unless info_requested
|
33
|
+
|
34
|
+
if !estados.empty? && valid_info?(info_requested)
|
35
|
+
return estados.map do |estado|
|
36
|
+
estado.public_send(info_requested)
|
37
|
+
end
|
38
|
+
end
|
30
39
|
end
|
31
40
|
|
32
41
|
# English aliases
|
@@ -42,6 +51,10 @@ module Brasil
|
|
42
51
|
|
43
52
|
private
|
44
53
|
|
54
|
+
def self.valid_info?(info_requested)
|
55
|
+
!info_requested || self.instance_methods.include?(info_requested.to_sym)
|
56
|
+
end
|
57
|
+
|
45
58
|
def self.sanitize(regiao)
|
46
59
|
regiao.downcase.capitalize.sub("-o", "-O")
|
47
60
|
end
|