def_enum_helper 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/def_enum_helper/version.rb +1 -1
- data/lib/def_enum_helper.rb +11 -2
- 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: 95c77f50f6fc43c3dd328a63a4bc291333a418e9
|
4
|
+
data.tar.gz: 838fd30ffac58e56b35a89bde9feb04fe671ed06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fc0cb77e66bd8e69026b65c28c87b2591d32940fd4342429ece0c876d8c8081e89df5ec8e2c2f142dc2a45682f284b0c5507bb8ffcf69123050c46cf98da894
|
7
|
+
data.tar.gz: 32d19d4b7e6d5e82c05e5570c6ecdcf51095ed024bd97b68e52a0b84bf85a430b16c38d8461b6616c60d260829dbac13f3fe45886597943d376b6de32abc5a8e
|
data/lib/def_enum_helper.rb
CHANGED
@@ -88,7 +88,12 @@ def define_subscript_method(m, enum_index_hash, enum_display_hash)
|
|
88
88
|
when String
|
89
89
|
enum_display_hash[k]
|
90
90
|
when Symbol
|
91
|
-
|
91
|
+
index = if self.is_a?(Module)
|
92
|
+
const_get(k)
|
93
|
+
else
|
94
|
+
Kernel.const_get(k)
|
95
|
+
end
|
96
|
+
enum_index_hash[index]
|
92
97
|
else
|
93
98
|
enum_index_hash[k]
|
94
99
|
end
|
@@ -130,5 +135,9 @@ def def_enum_struct_with_index(module_name, enum_hash, index_name: :index, displ
|
|
130
135
|
|
131
136
|
define_enum_methods(m, enum_index_hash, enum_display_hash)
|
132
137
|
|
133
|
-
|
138
|
+
if self.is_a?(Module)
|
139
|
+
const_set(module_name, m)
|
140
|
+
else
|
141
|
+
Kernel.const_set(module_name, m)
|
142
|
+
end
|
134
143
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: def_enum_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Charles Zhang
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|