In this case, I'm not sure I agree that empty strings are that bad
(nil would work, too)
table [[nil]*5]*5, :column_widths => { 0 => 100, 1 => 100, 2 => 150, 3
=> 150, 4 => 75 }
Doesn't look horrible to me. If this were commonplace, I'd allow for:
table(:rows => 5, :columns => 5, ...)
But I don't think it is. This seems like API bloat for something
which could be done in a user created subclass, no?
Of course, I could be convinced if I hear more evidence of people
actually wanting this feature.
At any rate, this is not what the OP was asking for. He was looking
for table([], options) to generate *just* a header column. To me
this is too uncommon to support, and would prevent us from easily
catching bugs related to expecting a 2d array but getting something
1d, or having a mismatch in number of columns.
> To be strict empty strings as data don't make a table 'not empty' so
> the exception should be raised too. ;)
I don't understand what you mean here. are you saying that if
row.all? { |e| e.empty? } we should raise an error? I think that's
crossing a line...
-greg