lib/pageflow/chart/downloader.rb in pageflow-chart-0.1.1 vs lib/pageflow/chart/downloader.rb in pageflow-chart-0.2.0
- old
+ new
@@ -24,15 +24,18 @@
file = Tempfile.new(['concatenation', options.fetch(:extension, 'txt')])
file.binmode
begin
urls.map do |url|
+ file.write(options[:before_each]) if options.key?(:before_each)
+
load(url) do |source|
while data = source.read(16 * 1024)
file.write(data)
end
end
+ file.write(options[:after_each]) if options.key?(:after_each)
file.write(options.fetch(:separator, "\n"))
end
file.rewind
yield(file)