lib/metacrunch/job.rb in metacrunch-4.0.2 vs lib/metacrunch/job.rb in metacrunch-4.0.3
- old
+ new
@@ -80,11 +80,11 @@
data = run_transformations(data)
write_destination(data)
end
# Run all transformations a last time to flush existing buffers
- data = run_transformations(data = nil, flush_buffers: true)
+ data = run_transformations(nil, flush_buffers: true)
write_destination(data)
# Close destination
destination.close if destination
end
@@ -118,25 +118,25 @@
end
def run_transformations(data, flush_buffers: false)
transformations.each do |transformation|
if transformation.is_a?(Buffer)
- if data.present?
+ if data
data = transformation.buffer(data)
data = transformation.flush if flush_buffers
else
data = transformation.flush
end
else
- data = transformation.call(data) if data.present?
+ data = transformation.call(data) if data
end
end
data
end
def write_destination(data)
- destination.write(data) if destination
+ destination.write(data) if destination && data
end
end
end