active_module 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9b89a72d9eb3c1f6de06429d825e774eab2f039126c46f1c410b0050d88bdfc6
|
|
4
|
+
data.tar.gz: f2955121a326352f383a734357406895a89ff3aca27ea03c39651ac734c187e9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 69638a53a743d8b834ccea349b7c4615bda8f785f2af6c5bf707203dde09eb2820ae1ac35c651743c76e402889ee93c42996808f46b5d851797564e392892f70
|
|
7
|
+
data.tar.gz: ab04085e13a62140ac4fbafe188e1f14fefec8f081f4352979a7d4e7181af1f3b97aeb580841d307a37a0a32b74592c4c8ad06de98ee9b3f5f456661d98d509f
|
|
@@ -30,8 +30,8 @@ module ActiveModule
|
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
-
def define_fields_method(attribute_name, modules)
|
|
34
|
-
fields = build_fields_map(modules)
|
|
33
|
+
def define_fields_method(attribute_name, modules, mapping)
|
|
34
|
+
fields = build_fields_map(modules, mapping)
|
|
35
35
|
name = attribute_name.to_s.pluralize
|
|
36
36
|
return if singleton_methods.include?(name.to_sym)
|
|
37
37
|
return if respond_to?(name)
|
|
@@ -39,9 +39,9 @@ module ActiveModule
|
|
|
39
39
|
define_singleton_method(name) { fields }
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
-
def build_fields_map(modules)
|
|
42
|
+
def build_fields_map(modules, mapping)
|
|
43
43
|
modules.each_with_object({}) do |mod, h|
|
|
44
|
-
h[mod] = mod.name
|
|
44
|
+
h[mod] = mapping[mod] || mod.name
|
|
45
45
|
end
|
|
46
46
|
end
|
|
47
47
|
end
|
data/lib/active_module/enum.rb
CHANGED