active_enum 1.0.0.rc7 → 1.0.0.rc8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_enum/base.rb +3 -3
- data/lib/active_enum/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 906926ead31439e2c3457cf32e453bf6c6a342245a6e8f0ce1d1debd6fd7b539
|
4
|
+
data.tar.gz: 13dd1539bded32f57ba862d4e0d068d6d3d0e7aae22bb8fe1078d6e9c823d261
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46d4c12f04dd2affd956488081f0735a9b19767ae4b370a912cf0ef31779a01d3c398da082bd1bb03e22156ccd647ace3eb54ed95a9628e81847299fdf8e0fc0
|
7
|
+
data.tar.gz: 3b362e15afb2b1cb5f2215577605027eacc3b3d15252bdca4e664baf8259c2caa72b50bac9314662323eb60869731b2a7385c84290dd239e838f5f1f5ac70182
|
data/lib/active_enum/base.rb
CHANGED
@@ -76,7 +76,7 @@ module ActiveEnum
|
|
76
76
|
alias_method :[], :get
|
77
77
|
|
78
78
|
def include?(value)
|
79
|
-
!
|
79
|
+
!get_value(value, false).nil?
|
80
80
|
end
|
81
81
|
|
82
82
|
# Access any meta data defined for a given id or name. Returns a hash.
|
@@ -88,12 +88,12 @@ module ActiveEnum
|
|
88
88
|
private
|
89
89
|
|
90
90
|
# Access value row array for a given id or name value.
|
91
|
-
def get_value(index)
|
91
|
+
def get_value(index, raise_on_not_found = ActiveEnum.raise_on_not_found)
|
92
92
|
if index.is_a?(Integer)
|
93
93
|
store.get_by_id(index)
|
94
94
|
else
|
95
95
|
store.get_by_name(index)
|
96
|
-
end || (
|
96
|
+
end || (raise_on_not_found ? raise(ActiveEnum::NotFound, "#{self} value for '#{index}' was not found") : nil)
|
97
97
|
end
|
98
98
|
|
99
99
|
def id_and_name_and_meta(hash)
|
data/lib/active_enum/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_enum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.rc8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Meehan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|