chainy 0.0.3 → 0.0.4
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 +4 -4
- data/lib/chainy/config.rb +3 -1
- data/lib/chainy/module.rb +25 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eacaf41235bbe33c6a7409cdc0eabdac45457fe7
|
4
|
+
data.tar.gz: cee080a5b426d7dbb94afd476a647bc3b160d272
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da4bc56e42c4471db6cbcf0dc77e78d22c9d47cf8fec6d15b2583e91d7e771f975685068b1ad64551e6111fa9f1befaedc5fec66b0c971b0a9e8ffaf3c008254
|
7
|
+
data.tar.gz: b7a392362157a0a93987da633c388fbcd5203f1ed17c38521611efebfc3157bbecb6663944ebc24c59c50a8385c74a398974c1e8a52a45c5d892761b9b9bb41d
|
data/lib/chainy/config.rb
CHANGED
data/lib/chainy/module.rb
CHANGED
@@ -13,11 +13,31 @@ class Module
|
|
13
13
|
[].tap do |method_names|
|
14
14
|
method_names << symbol
|
15
15
|
method_names.concat args
|
16
|
-
end.each do |
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
end.each do |getter_method|
|
17
|
+
instance_variable_name = "@#{getter_method}"
|
18
|
+
|
19
|
+
if opts[:hash]
|
20
|
+
define_method(getter_method) do
|
21
|
+
instance_variable_set instance_variable_name, instance_variable_get(instance_variable_name) || {}
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
new_method_name = "#{prefix}_#{getter_method}"
|
26
|
+
|
27
|
+
if opts[:hash]
|
28
|
+
|
29
|
+
define_method(new_method_name) do |hash|
|
30
|
+
instance_variable_set instance_variable_name, send(getter_method).merge(hash)
|
31
|
+
self
|
32
|
+
end
|
33
|
+
|
34
|
+
else
|
35
|
+
|
36
|
+
define_method(new_method_name) do |*args|
|
37
|
+
send "#{getter_method}=", *args
|
38
|
+
self
|
39
|
+
end
|
40
|
+
|
21
41
|
end
|
22
42
|
end
|
23
43
|
end
|