active_enum 1.0.0.pre → 1.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +1 -1
- data/lib/active_enum/acts_as_enum.rb +1 -1
- 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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abc265242b6f277fd73cd50f675eb3e966407cda
|
4
|
+
data.tar.gz: 5b4c18dd92b26c6282afa3ba13e131d9ac916bd0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0a0d1e62906848e9a031e6bb8cd27071a3fa4b2b6919d4311eb7fbae2fcfb1676f9a6d292d94d462a167d2b084cccc795e37d58d65c0af25f6db5a9bf1f08f8
|
7
|
+
data.tar.gz: 5c9cb81a882a6ddaf6c2e3c6d864598e85d544e91f835ea711b9881a2c710b1b20b5812987481dc50975ee13ff60814cda8967fc36058f67dfed5a873b45947e
|
data/README.rdoc
CHANGED
@@ -7,7 +7,7 @@ Enum values are stored in memory at the moment but I plan to add database and po
|
|
7
7
|
|
8
8
|
== Install
|
9
9
|
|
10
|
-
|
10
|
+
Supports Ruby versions 2.0+.
|
11
11
|
|
12
12
|
From gem version 1.0 onwards this plugin will only have Rails 4+ support. If you need Rails 3 compatibility, {check the 0.9 branch}[https://github.com/adzap/active_enum/tree/0.9].
|
13
13
|
|
data/lib/active_enum/base.rb
CHANGED
@@ -62,13 +62,13 @@ module ActiveEnum
|
|
62
62
|
def get(index)
|
63
63
|
row = get_value(index)
|
64
64
|
return if row.nil?
|
65
|
-
index.is_a?(
|
65
|
+
index.is_a?(Integer) ? row[1] : row[0]
|
66
66
|
end
|
67
67
|
alias_method :[], :get
|
68
68
|
|
69
69
|
# Access value row array for a given id or name value.
|
70
70
|
def get_value(index)
|
71
|
-
if index.is_a?(
|
71
|
+
if index.is_a?(Integer)
|
72
72
|
store.get_by_id(index)
|
73
73
|
else
|
74
74
|
store.get_by_name(index)
|
@@ -93,7 +93,7 @@ module ActiveEnum
|
|
93
93
|
name = hash.delete(:name)
|
94
94
|
meta = hash
|
95
95
|
return id, name, (meta.empty? ? nil : meta)
|
96
|
-
elsif hash.keys.first.is_a?(
|
96
|
+
elsif hash.keys.first.is_a?(Integer)
|
97
97
|
return *Array(hash).first
|
98
98
|
else
|
99
99
|
raise ActiveEnum::InvalidValue, "The value supplied, #{hash}, is not a valid format."
|
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.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Meehan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|