tubes 0.1.3 → 0.1.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.
- data/lib/tubes.rb +19 -3
- metadata +1 -1
data/lib/tubes.rb
CHANGED
@@ -64,7 +64,7 @@ class Tube
|
|
64
64
|
def invoke(klass, *args)
|
65
65
|
@invocations += 1
|
66
66
|
|
67
|
-
options = {:order => @order, :parent =>
|
67
|
+
options = {:order => @order, :parent => self}
|
68
68
|
segment = klass.new @dir, options
|
69
69
|
|
70
70
|
step = segment.name
|
@@ -103,6 +103,8 @@ class Tube
|
|
103
103
|
|
104
104
|
STDOUT.flush
|
105
105
|
end
|
106
|
+
|
107
|
+
nil # Behave like Kernel.puts
|
106
108
|
end
|
107
109
|
|
108
110
|
|
@@ -142,9 +144,23 @@ class Tube
|
|
142
144
|
end
|
143
145
|
|
144
146
|
def dispatch(segment, output_file, *args)
|
145
|
-
output = if segment.method(:run).arity
|
147
|
+
output = if segment.method(:run).arity > 0 # Optional arguments result in negative arity.
|
148
|
+
if args.empty?
|
149
|
+
if @invocations > 1
|
150
|
+
segment.send :run, @output
|
151
|
+
else
|
152
|
+
segment.send :run # This should raise an argument mismatch error.
|
153
|
+
end
|
154
|
+
else
|
155
|
+
segment.send :run, *args
|
156
|
+
end
|
157
|
+
elsif segment.method(:run).arity < 0
|
146
158
|
if args.empty?
|
147
|
-
|
159
|
+
if @invocations > 1
|
160
|
+
segment.send :run, @output
|
161
|
+
else
|
162
|
+
segment.send :run
|
163
|
+
end
|
148
164
|
else
|
149
165
|
segment.send :run, *args
|
150
166
|
end
|