Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A fix for issues/6: Colspan in first row breaks layout #7

Closed
wants to merge 1 commit into from

Conversation

niko
Copy link

@niko niko commented Aug 5, 2011

#6

@scottjg
Copy link
Collaborator

scottjg commented Oct 16, 2011

hi. sorry for the delay, i'm going through the backlog of patches now. it seems the code has now changed enough that this patch no longer seems to fix the attached test. if you wouldn't mind fixing it up, i would be happy to merge. keep in mind that a bunch of the other tests are also now broken (i am in the process of fixing them)

@rrrene
Copy link
Contributor

rrrene commented Oct 16, 2011

This is a pretty easy fix now: in lib/terminal-table/table.rb

    def number_of_columns
      if rows.empty?
        raise Error, 'your table needs some rows'
      else
        rows.first.size
      end
    end

Just replace rows.first.size with

rows.map { |r| r.size }.max

This "searches" the whole table for the maximum number of columns.

@nateberkopec
Copy link
Collaborator

It looks to me as if the fix above by @rrrene was applied with 4165427

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants