Open dzfolio opened 5 months ago
Hi @dzfolio. Thanks for the contribution! I don't mind this feature, but I wonder if it would be simpler to just make the
AsCSV::CSVBuilder#headers
method public? I realise this isn't functionally equivalent, but then if you only want the headers you can callheaders
on the CSVBuilder object instead ofto_csv
. How does this sound?
sure sounds reasonable to me. should I break out tests for #headers or do you think it's covered enough from existing tests
should I break out tests for #headers or
Good question. I think since it's now part of the public interface it's worth having a few basic tests against it. You can even just copy the relevant to_csv contexts/specs and change the assertions to check the headers. I don't mind if the spec is not DRY in this case.
we have a use case where we'd like to generate only the headers. in order to generate the headers correctly we do need to look at all rows and collect/uniq them, why is why I am adding it to csv_builder
please let me know feedback