lib/io_streams/stream.rb in iostreams-1.0.0.beta6 vs lib/io_streams/stream.rb in iostreams-1.0.0.beta7
- old
+ new
@@ -106,9 +106,14 @@
stream.stream(:none).reader { |src| IO.copy_stream(src, target) }
end
end
end
+ def copy_to(target, convert: true)
+ target = IOStreams.path(target) unless target.is_a?(Stream)
+ target.copy_from(self, convert: convert)
+ end
+
# Iterate over a file / stream returning one line at a time.
# Embedded lines (within double quotes) will be skipped if
# 1. The file name contains .csv
# 2. Or the embedded_within argument is set
#