roo-rb / roo

Roo provides an interface to spreadsheets of several sorts.
MIT License
2.78k stars 503 forks source link

fix: info will break if e.g. Roo::CSV is initialized by stream object #544

Open TomFreudenberg opened 3 years ago

TomFreudenberg commented 3 years ago

Summary

This is a bug fix for method Base::info when object is initialized by stream and not filename

require 'roo'

content = "Id;Name;Surname;Title\n"
(1..1000).each { |i| content << "#{i};John;Wick;Actor\n" }
content_io = StringIO.new(content)
spreadsheet = Roo::CSV.new(content_io, csv_options: { col_sep: ';' })
puts spreadsheet.info
spreadsheet.reload
puts spreadsheet.info

What happens without this fix: