Fixed the behaviour of Table when the specified width exceeds column width #30

merged 1 commit into from Apr 13, 2015

7 participants


This should fix issues/23.


I ran into this bug too. I'm going to open up a separate issue though because a much bigger problem is how you figure out how to wrap a column without knowing its length, there isn't really a way for the user to find out the evetual length to wrap things properly...


If you don't care about the overall table width, having fields with unknown length should be already handled by the default behaviour of the Table object. On the other hand, if you still want the table to have a fixed width, I guess the only option is to either throw an Error or add a style modifier to truncate the contents artificially:

rows << ['Four', 'A' * 120]
table =
table.headings = ['Word', 'Number']
table.rows = rows = {:width => 80, :truncate => true}

# > puts table
# +--------------------------------------+---------------------------------------+
# | Word                                 | Number                                |
# +--------------------------------------+---------------------------------------+
# | One                                  | 1                                     |
# | Two                                  | 2                                     |
# | Three                                | 3                                     |
# | Four                                 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... |
# +--------------------------------------+---------------------------------------+

Hey all, is this likely to be fixed soon?


Can I help in merging this? We have a number of bugs depending on this.


I came across this same issue, started to write a PR but found this. Is this to be merged?


...year and a half later. whats the status on this?



@nateberkopec nateberkopec merged commit eb34698 into tj:master Apr 13, 2015

Thank you @nateberkopec ! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment