enumerate_it 1.2.4 → 1.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 55c9991c5866408583f6c824a30564be4c25ac16
4
+ data.tar.gz: 553a8914d8ecb9c4db2b2402bdc1cf26f8b2ecb9
5
+ SHA512:
6
+ metadata.gz: 4488bdb747ccb40dc21feccf8bc6cccf41eb782cd05519e9c71c0ebb232bcd14a8026300c0b373c12d4e8f4c0ebcc30e57bbff047e45fc609b7dbe4490befc95
7
+ data.tar.gz: 31aae52d45cd1b8adaef5941283fd2d824aacc28f2db2b71e76d15e3c2e578e7b1348ca891bbbbd4ff90dda318be92cb271c943df51f826955e21ed26e3508e2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- enumerate_it (1.2.4)
4
+ enumerate_it (1.2.5)
5
5
  activesupport (>= 3.0.0)
6
6
 
7
7
  GEM
@@ -65,6 +65,10 @@ module EnumerateIt
65
65
  nil
66
66
  end
67
67
 
68
+ def self.value_from_key(key)
69
+ (enumeration[key.to_sym] || []).first
70
+ end
71
+
68
72
  def self.keys
69
73
  enumeration.keys
70
74
  end
@@ -1,3 +1,3 @@
1
1
  module EnumerateIt
2
- VERSION = "1.2.4"
2
+ VERSION = "1.2.5"
3
3
  end
@@ -115,6 +115,20 @@ describe EnumerateIt::Base do
115
115
  end
116
116
  end
117
117
 
118
+ describe ".value_from_key" do
119
+ it "returns the correct value when the key is a string" do
120
+ TestEnumeration.value_from_key("value_1").should == TestEnumeration::VALUE_1
121
+ end
122
+
123
+ it "returns the correct value when the key is a symbol" do
124
+ TestEnumeration.value_from_key(:value_1).should == TestEnumeration::VALUE_1
125
+ end
126
+
127
+ it "returns nil when the key does not exist in the enumeration" do
128
+ TestEnumeration.value_from_key("wrong").should be_nil
129
+ end
130
+ end
131
+
118
132
  describe ".keys" do
119
133
  it "returns a list with the keys used to define the enumeration" do
120
134
  TestEnumeration.keys.should == [:value_1, :value_2, :value_3]
metadata CHANGED
@@ -1,112 +1,99 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enumerate_it
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
5
- prerelease:
4
+ version: 1.2.5
6
5
  platform: ruby
7
6
  authors:
8
7
  - Cássio Marques
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2015-02-02 00:00:00.000000000 Z
11
+ date: 2015-03-10 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: activesupport
16
- type: :runtime
17
15
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
16
  requirements:
20
- - - ! '>='
17
+ - - ">="
21
18
  - !ruby/object:Gem::Version
22
19
  version: 3.0.0
20
+ type: :runtime
21
+ prerelease: false
23
22
  version_requirements: !ruby/object:Gem::Requirement
24
- none: false
25
23
  requirements:
26
- - - ! '>='
24
+ - - ">="
27
25
  - !ruby/object:Gem::Version
28
26
  version: 3.0.0
29
- prerelease: false
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
- type: :development
33
29
  requirement: !ruby/object:Gem::Requirement
34
- none: false
35
30
  requirements:
36
- - - ! '>='
31
+ - - ">="
37
32
  - !ruby/object:Gem::Version
38
33
  version: '0'
34
+ type: :development
35
+ prerelease: false
39
36
  version_requirements: !ruby/object:Gem::Requirement
40
- none: false
41
37
  requirements:
42
- - - ! '>='
38
+ - - ">="
43
39
  - !ruby/object:Gem::Version
44
40
  version: '0'
45
- prerelease: false
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rspec
48
- type: :development
49
43
  requirement: !ruby/object:Gem::Requirement
50
- none: false
51
44
  requirements:
52
- - - ! '>='
45
+ - - ">="
53
46
  - !ruby/object:Gem::Version
54
47
  version: 2.5.0
48
+ type: :development
49
+ prerelease: false
55
50
  version_requirements: !ruby/object:Gem::Requirement
56
- none: false
57
51
  requirements:
58
- - - ! '>='
52
+ - - ">="
59
53
  - !ruby/object:Gem::Version
60
54
  version: 2.5.0
61
- prerelease: false
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: activerecord
64
- type: :development
65
57
  requirement: !ruby/object:Gem::Requirement
66
- none: false
67
58
  requirements:
68
- - - ! '>='
59
+ - - ">="
69
60
  - !ruby/object:Gem::Version
70
61
  version: 3.0.5
62
+ type: :development
63
+ prerelease: false
71
64
  version_requirements: !ruby/object:Gem::Requirement
72
- none: false
73
65
  requirements:
74
- - - ! '>='
66
+ - - ">="
75
67
  - !ruby/object:Gem::Version
76
68
  version: 3.0.5
77
- prerelease: false
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: pry
80
- type: :development
81
71
  requirement: !ruby/object:Gem::Requirement
82
- none: false
83
72
  requirements:
84
- - - ! '>='
73
+ - - ">="
85
74
  - !ruby/object:Gem::Version
86
75
  version: '0'
76
+ type: :development
77
+ prerelease: false
87
78
  version_requirements: !ruby/object:Gem::Requirement
88
- none: false
89
79
  requirements:
90
- - - ! '>='
80
+ - - ">="
91
81
  - !ruby/object:Gem::Version
92
82
  version: '0'
93
- prerelease: false
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: pry-nav
96
- type: :development
97
85
  requirement: !ruby/object:Gem::Requirement
98
- none: false
99
86
  requirements:
100
- - - ! '>='
87
+ - - ">="
101
88
  - !ruby/object:Gem::Version
102
89
  version: '0'
90
+ type: :development
91
+ prerelease: false
103
92
  version_requirements: !ruby/object:Gem::Requirement
104
- none: false
105
93
  requirements:
106
- - - ! '>='
94
+ - - ">="
107
95
  - !ruby/object:Gem::Version
108
96
  version: '0'
109
- prerelease: false
110
97
  description: Enumerations for Ruby with some magic powers!
111
98
  email:
112
99
  - cassiommc@gmail.com
@@ -114,9 +101,9 @@ executables: []
114
101
  extensions: []
115
102
  extra_rdoc_files: []
116
103
  files:
117
- - .document
118
- - .gitignore
119
- - .travis.yml
104
+ - ".document"
105
+ - ".gitignore"
106
+ - ".travis.yml"
120
107
  - Gemfile
121
108
  - Gemfile.lock
122
109
  - LICENSE
@@ -143,33 +130,26 @@ files:
143
130
  - spec/support/test_classes.rb
144
131
  homepage: http://github.com/cassiomarques/enumerate_it
145
132
  licenses: []
133
+ metadata: {}
146
134
  post_install_message:
147
135
  rdoc_options: []
148
136
  require_paths:
149
137
  - lib
150
138
  required_ruby_version: !ruby/object:Gem::Requirement
151
- none: false
152
139
  requirements:
153
- - - ! '>='
140
+ - - ">="
154
141
  - !ruby/object:Gem::Version
155
- segments:
156
- - 0
157
142
  version: '0'
158
- hash: 786857682386495207
159
143
  required_rubygems_version: !ruby/object:Gem::Requirement
160
- none: false
161
144
  requirements:
162
- - - ! '>='
145
+ - - ">="
163
146
  - !ruby/object:Gem::Version
164
- segments:
165
- - 0
166
147
  version: '0'
167
- hash: 786857682386495207
168
148
  requirements: []
169
149
  rubyforge_project:
170
- rubygems_version: 1.8.24
150
+ rubygems_version: 2.2.2
171
151
  signing_key:
172
- specification_version: 3
152
+ specification_version: 4
173
153
  summary: Ruby Enumerations
174
154
  test_files:
175
155
  - spec/enumerate_it/base_spec.rb