enumerative 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/enumerative/enumeration.rb +13 -5
- data/lib/enumerative/version.rb +1 -1
- metadata +2 -2
@@ -30,11 +30,19 @@
|
|
30
30
|
|
31
31
|
end
|
32
32
|
|
33
|
-
def initialize(
|
34
|
-
key =
|
35
|
-
|
36
|
-
|
37
|
-
|
33
|
+
def initialize( key_hash_or_enum )
|
34
|
+
key = nil
|
35
|
+
if key_hash_or_enum.is_a?( Hash )
|
36
|
+
key = key_hash_or_enum['key'] || key_hash_or_enum[:key]
|
37
|
+
elsif key_hash_or_enum.is_a?( Enumerative::Enumeration )
|
38
|
+
key = key_hash_or_enum.key
|
39
|
+
else
|
40
|
+
key = key_hash_or_enum
|
41
|
+
end
|
42
|
+
|
43
|
+
@key = (key.nil? || key.empty?) ?
|
44
|
+
nil :
|
45
|
+
key.to_s.try( :dup ).try( :freeze )
|
38
46
|
end
|
39
47
|
|
40
48
|
def ==( other )
|
data/lib/enumerative/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enumerative
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-
|
13
|
+
date: 2014-03-03 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|