enumerate_it 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZGI4ZDc1NjJkOTdiODA5Zjg4Y2ExMmMzNGY2OWUzODkxZWVlNmY4Ng==
4
+ Mjk3OWI5YmVhYjVkZWUxN2ZhNzVlMWVkYjRhZDhlNDQwZWY2NjQ4ZQ==
5
5
  data.tar.gz: !binary |-
6
- M2YxZjM3NjhkYzg5NTVhM2ViODQ1YjU4NzNkNjYxMzYzN2U2YjZkNA==
6
+ M2QzNTcwYTQzOTU2ZmQ1MzBjMzc2YWVlMDkwMmE5NjJlNDNlYjRlOA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZmM2MDI1OWRmNzlmNjgwMWI1YzZlMzdhNjg3NzFlOWFmODgxNTQzYzMzOGQz
10
- NWQ0YWUzYTQyYzc1MDk2OGE4NDYyMWU5OTA0OTliYzUzNTY0MjFjNmFlMGZk
11
- ZjMzODE0Y2VjZjYyM2NhMTM5M2ZiNjdlOTVmODM1MTAwNzUzYTM=
9
+ NjQ2OWVhNDVhZjg0MjJmZGRkMzYxODU5MWY1ZTFlYTc3ZDk0ZGFiNjBkYjA5
10
+ M2E1YTYwOGZjMjU1ZjQyNjcyMTNmODkxMDdhNzEyM2IzYTk3OTg2YmQzODVk
11
+ YTFmNzA5ZTU0NTYyNmJjZTIwYzYzZTZhZTNjOTk1MzgyNDY3NWQ=
12
12
  data.tar.gz: !binary |-
13
- OWNkZmY1ZTc5YTU4OTdkZmM2YzViMTgxYTI5NWJjNzlkZDQ2ZDMwYmEzZDYx
14
- ZTk4YzRmNjg3MTI3MjE0ZjgwNGZjMjVlZTgxNjA0OGQ0NmNjZjM2OWE4OThh
15
- Mzk3ZmFhMTc3Zjk0M2EzYjBkMDVlMGUzYTU5ZDQwNGFlMzE0YzA=
13
+ NzIzZjY4YTgwM2FiNGI0MTQxNmZmY2JhYWUyYjk3YzJhYTlkOTY2ZmE1ZjJm
14
+ ODljNmQwNjVkNTczMjY5NzAzOGI5MjU4ODE4OTY3Yzc1MmQ5OTBjODUyMzI2
15
+ Y2RjMmNiOTZjY2I2ZGM4NDgzNzllNzY0MWRhNDUzMDFlZmI4NWU=
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- enumerate_it (1.2.1)
4
+ enumerate_it (1.2.2)
5
5
  activesupport (>= 3.0.0)
6
6
 
7
7
  GEM
@@ -127,6 +127,12 @@ This will create some nice stuff:
127
127
  RelationshipStatus.each_translation { |translation| ... }
128
128
  ```
129
129
 
130
+ * You can also retrieve all the translations of the enumeration:
131
+
132
+ ``` ruby
133
+ RelationshipStatus.translations
134
+ ```
135
+
130
136
  * You can ask for the enumeration's length:
131
137
 
132
138
  ``` ruby
@@ -398,7 +404,7 @@ only to those derived from ActiveRecord::Base.
398
404
 
399
405
  ## I18n
400
406
 
401
- I18n lookup is provided on both '_humanized' and 'Enumeration#to_a' methods,
407
+ I18n lookup is provided on both `_humanized` and `Enumeration#to_a` methods,
402
408
  given the hash key is a Symbol. The I18n strings are located on
403
409
  enumerations.'enumeration_name'.'key' :
404
410
 
@@ -38,6 +38,10 @@ module EnumerateIt
38
38
  each_value { |value| yield t(value) }
39
39
  end
40
40
 
41
+ def self.translations
42
+ list.map { |value| t(value) }
43
+ end
44
+
41
45
  def self.each_value
42
46
  list.each { |value| yield value }
43
47
  end
@@ -1,3 +1,3 @@
1
1
  module EnumerateIt
2
- VERSION = "1.2.1"
2
+ VERSION = "1.2.2"
3
3
  end
@@ -36,6 +36,12 @@ describe EnumerateIt::Base do
36
36
  end
37
37
  end
38
38
 
39
+ describe ".translations" do
40
+ it "returns all translations" do
41
+ TestEnumeration.translations.should == ["Hey, I am 1!", "Hey, I am 2!", "Hey, I am 3!"]
42
+ end
43
+ end
44
+
39
45
  describe ".each_value" do
40
46
  it "yields each enumeration's value" do
41
47
  values = []
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enumerate_it
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cássio Marques
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-07 00:00:00.000000000 Z
11
+ date: 2014-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport