lib/io_streams/stream.rb in iostreams-1.2.0 vs lib/io_streams/stream.rb in iostreams-1.2.1
- old
+ new
@@ -280,45 +280,45 @@
end
def line_reader(embedded_within: nil, **args)
embedded_within = '"' if embedded_within.nil? && builder.file_name&.include?(".csv")
- stream_reader { |io| yield IOStreams::Line::Reader.new(io, embedded_within: embedded_within, **args) }
+ stream_reader { |io| yield IOStreams::Line::Reader.new(io, original_file_name: builder.file_name, embedded_within: embedded_within, **args) }
end
# Iterate over a file / stream returning each line as an array, one at a time.
def row_reader(delimiter: nil, embedded_within: nil, **args)
line_reader(delimiter: delimiter, embedded_within: embedded_within) do |io|
- yield IOStreams::Row::Reader.new(io, **args)
+ yield IOStreams::Row::Reader.new(io, original_file_name: builder.file_name, **args)
end
end
# Iterate over a file / stream returning each line as a hash, one at a time.
def record_reader(delimiter: nil, embedded_within: nil, **args)
line_reader(delimiter: delimiter, embedded_within: embedded_within) do |io|
- yield IOStreams::Record::Reader.new(io, **args)
+ yield IOStreams::Record::Reader.new(io, original_file_name: builder.file_name, **args)
end
end
def stream_writer(&block)
builder.writer(io_stream, &block)
end
def line_writer(**args, &block)
return block.call(io_stream) if io_stream&.is_a?(IOStreams::Line::Writer)
- writer { |io| IOStreams::Line::Writer.stream(io, **args, &block) }
+ writer { |io| IOStreams::Line::Writer.stream(io, original_file_name: builder.file_name, **args, &block) }
end
def row_writer(delimiter: $/, **args, &block)
return block.call(io_stream) if io_stream&.is_a?(IOStreams::Row::Writer)
- line_writer(delimiter: delimiter) { |io| IOStreams::Row::Writer.stream(io, **args, &block) }
+ line_writer(delimiter: delimiter) { |io| IOStreams::Row::Writer.stream(io, original_file_name: builder.file_name, **args, &block) }
end
def record_writer(delimiter: $/, **args, &block)
return block.call(io_stream) if io_stream&.is_a?(IOStreams::Record::Writer)
- line_writer(delimiter: delimiter) { |io| IOStreams::Record::Writer.stream(io, **args, &block) }
+ line_writer(delimiter: delimiter) { |io| IOStreams::Record::Writer.stream(io, original_file_name: builder.file_name, **args, &block) }
end
end
end