Closed BurdetteLamar closed 4 years ago
Looking closely now at improving the doc for CSV::Table and CSV::Row.
It's going to be much, much easier and clearer to document errors if we do early error checking. For example, in CSV::Row.new, we could begin:
def initialize(headers, fields, header_row = false) headers = Array::try_convert(headers) unless headers message = "Expected argument headers to be Array-convertible, not #{headers}" raise ArgumentError.new(message) end fields = Array::try_convert(fields) unless fields message = "Expected argument fields to be Array-convertible, not #{fields}" raise ArgumentError.new(message) end ...
Would this hurt performance too much?
The alternative, as now, is getting a missing-method message involving 'each' or 'zip', which is less clear.
Looking closely now at improving the doc for CSV::Table and CSV::Row.
It's going to be much, much easier and clearer to document errors if we do early error checking. For example, in CSV::Row.new, we could begin:
Would this hurt performance too much?
The alternative, as now, is getting a missing-method message involving 'each' or 'zip', which is less clear.