fabrique 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fabrique/bean_definition.rb +5 -5
- data/lib/fabrique/version.rb +1 -1
- 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: 3796e9e745800e240d127f0672f1c8d22ab40745
|
4
|
+
data.tar.gz: 8a4ce3af7cfd0a4be962e95df662d15d2b2b15d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04869a6c8850d01a46188df165ca99f04004943cd902c19e21fc97f53248f4248462435e7b74e4f0c6d66aca8f7fcbe530cddabfdf324578006bac48e60335e7
|
7
|
+
data.tar.gz: af63e7a6b236ba0bbb0cd3216604d2059072dedafe9f675eb342e16bead68fc2942a3369061edfa04666ae3a85d0769874d85cfda41cd5499a2e3d9c36e69868
|
@@ -6,7 +6,7 @@ module Fabrique
|
|
6
6
|
def initialize(attrs = {})
|
7
7
|
@id = attrs["id"]
|
8
8
|
type_name = attrs["class"]
|
9
|
-
@type = type_name.is_a?(Module) ?
|
9
|
+
@type = type_name.is_a?(Module) ? type_name : Module.const_get(type_name)
|
10
10
|
@constructor_args = attrs["constructor_args"] || []
|
11
11
|
@constructor_args = keywordify(@constructor_args) if @constructor_args.is_a?(Hash)
|
12
12
|
@properties = attrs["properties"] || {}
|
@@ -15,7 +15,7 @@ module Fabrique
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def dependencies
|
18
|
-
(
|
18
|
+
(accumulate_dependencies(@constructor_args) + accumulate_dependencies(@properties)).uniq
|
19
19
|
end
|
20
20
|
|
21
21
|
def singleton?
|
@@ -28,12 +28,12 @@ module Fabrique
|
|
28
28
|
args.inject({}) { |m, (k, v)| k = k.intern rescue k; m[k.intern] = v; m }
|
29
29
|
end
|
30
30
|
|
31
|
-
def
|
31
|
+
def accumulate_dependencies(data, acc = [])
|
32
32
|
if data.is_a?(Hash)
|
33
|
-
|
33
|
+
accumulate_dependencies(data.values, acc)
|
34
34
|
elsif data.is_a?(Array)
|
35
35
|
data.each do |o|
|
36
|
-
|
36
|
+
accumulate_dependencies(o, acc)
|
37
37
|
end
|
38
38
|
elsif data.is_a?(BeanReference) or data.is_a?(BeanPropertyReference)
|
39
39
|
acc << data
|
data/lib/fabrique/version.rb
CHANGED