ul-wukong 4.1.0 → 4.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/wukong/dataflow.rb +52 -4
- data/lib/wukong/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MDJmYjc2NGI4YzExYjAzZjIwODhkY2U5NzVlY2I0MzU4MmQ4YjIxYg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NjhkMzNkYjU5MzE0YmQwODE2MWQ1Y2UzNDlkOWYwMDU0MjM3MmU3OQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NmE2ZmVjMmEyOGM4NzVhNjQ5MDE1OWY0MzkzOGMwZWIwM2E2OGFmMTJmNzBk
|
10
|
+
YzgxOGJhMzRkZmQ2YzE2YmVmZGQ0YTk5OTZjMzY1YmFhNTc0YTgyYTg1ZTI0
|
11
|
+
MDU1OThmZWVlZTMxYjM1MDBlMWIzOGI3MGFlZGU5MGM1YzQxMjA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MzVmYmExYzlhN2Y0YWM5ZjhiNDgyMzAyMzgzYTlkN2I1NjQ2NGRlYmJkMDVh
|
14
|
+
M2Y3NWRiYzY0NTgwNTA0OGQwN2I0MjEyYjg2YTQ1N2IzZjdhYWFlM2EyMzcy
|
15
|
+
NjZmODc3YWJiZDM3Mzg4MWM2ZDBjNDgxYTY3OGI3M2ZhMTMxN2U=
|
data/lib/wukong/dataflow.rb
CHANGED
@@ -4,15 +4,63 @@ module Wukong
|
|
4
4
|
def self.configure(settings)
|
5
5
|
settings.description = builder.description if builder.description
|
6
6
|
end
|
7
|
+
|
8
|
+
def setup
|
9
|
+
each_stage do |stage|
|
10
|
+
stage.setup
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def process(record, &emit)
|
15
|
+
process_list(record, [root], &emit)
|
16
|
+
end
|
17
|
+
|
18
|
+
def finalize(&emit)
|
19
|
+
finalize_list([root], &emit)
|
20
|
+
end
|
21
|
+
|
22
|
+
def stop
|
23
|
+
each_stage do |stage|
|
24
|
+
stage.stop
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
def process_list(record, stages, &emit)
|
30
|
+
stages.each do |stage|
|
31
|
+
children = descendents(stage)
|
32
|
+
if children.empty?
|
33
|
+
stage.process(record, &emit)
|
34
|
+
else
|
35
|
+
stage.process(record) do |out|
|
36
|
+
process_list(out, children, &emit)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def finalize_list(stages, &emit)
|
43
|
+
stages.each do |stage|
|
44
|
+
children = descendents(stage)
|
45
|
+
if children.empty?
|
46
|
+
stage.finalize(&emit)
|
47
|
+
else
|
48
|
+
stage.finalize do |out|
|
49
|
+
process_list(out, children, &emit)
|
50
|
+
end
|
51
|
+
finalize_list(children, &emit)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
7
55
|
end
|
8
|
-
|
56
|
+
|
9
57
|
class DataflowBuilder < Hanuman::TreeBuilder
|
10
58
|
|
11
59
|
def description desc=nil
|
12
60
|
@description = desc if desc
|
13
61
|
@description
|
14
62
|
end
|
15
|
-
|
63
|
+
|
16
64
|
def namespace() Wukong::Dataflow ; end
|
17
65
|
|
18
66
|
def handle_dsl_arguments_for(stage, *args, &action)
|
@@ -30,7 +78,7 @@ module Wukong
|
|
30
78
|
stage.graph = self
|
31
79
|
stage
|
32
80
|
end
|
33
|
-
|
81
|
+
|
34
82
|
def method_missing(name, *args, &blk)
|
35
83
|
if stages[name]
|
36
84
|
handle_dsl_arguments_for(stages[name], *args, &blk)
|
@@ -38,6 +86,6 @@ module Wukong
|
|
38
86
|
super
|
39
87
|
end
|
40
88
|
end
|
41
|
-
|
89
|
+
|
42
90
|
end
|
43
91
|
end
|
data/lib/wukong/version.rb
CHANGED