stages 0.2.9 → 0.2.10
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/stages/wrap.rb +18 -5
- data/stages.gemspec +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.10
|
data/lib/stages/wrap.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
module Stages
|
2
|
-
class Wrap < Stage
|
2
|
+
class Wrap < Stage
|
3
3
|
def initialize(pipeline, *args)
|
4
4
|
@pipeline = pipeline
|
5
5
|
@output_style = :hash
|
6
6
|
unless args.empty?
|
7
7
|
if args.include? :array
|
8
|
-
@output_style = :array
|
8
|
+
@output_style = :array
|
9
9
|
elsif args.include? :each
|
10
10
|
@output_style = :each
|
11
11
|
end
|
@@ -13,20 +13,33 @@ module Stages
|
|
13
13
|
end
|
14
14
|
super()
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
|
+
def reset
|
18
|
+
initialize_loop
|
19
|
+
@pipeline.reset!
|
20
|
+
@source.reset if @source
|
21
|
+
end
|
22
|
+
|
23
|
+
def reset!
|
24
|
+
initialize_loop
|
25
|
+
@pipeline.reset!
|
26
|
+
@source.reset! if @source
|
27
|
+
end
|
28
|
+
|
17
29
|
def process
|
18
30
|
while value = input
|
19
31
|
subpipe = Emit.new(value) | @pipeline
|
20
32
|
results = []
|
21
33
|
while v = subpipe.run
|
22
34
|
@output_style == :each ? output(v) : results << v
|
23
|
-
end
|
35
|
+
end
|
24
36
|
results = results.first if @aggregated
|
25
37
|
output results if @output_style == :array
|
26
38
|
output({ value => results}) if @output_style == :hash
|
27
39
|
@pipeline.drop_leftmost!
|
28
40
|
@pipeline.reset!
|
29
41
|
end
|
42
|
+
@pipeline.reset!
|
30
43
|
end
|
31
|
-
end
|
44
|
+
end
|
32
45
|
end
|
data/stages.gemspec
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: stages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.2.
|
5
|
+
version: 0.2.10
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- The Justice Eight
|
@@ -73,7 +73,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
73
73
|
requirements:
|
74
74
|
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
hash:
|
76
|
+
hash: 4574983875197029108
|
77
77
|
segments:
|
78
78
|
- 0
|
79
79
|
version: "0"
|