1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00
pry--pry/lib/pry/helpers
Kyrylo Silin 9074613927 Helpers::tablify: fix FloatDomainError
Before this commit the following snippet didn't work:

  pry(main)> Pry::Helpers.tablify(['foobar', 'baz'], 5)
  #=> FloatDomainError

There was a divison by zero in `Helpers::Table#_recolumn`.

The problem is incorrectly written `until` loop condition. Note that the
longest element in the array has 6 characters. But the second argument
tells `::tablify` that the line width is only 5 characters long.

This commit changes the condition. Now, if you run the same snippet, you
would see that the elements form one column (and the code doesn't blow
up your program).

Possibly, in the described case, the table has unwanted blanks. However,
I'm not very competent in the code, so I'd better not touch it, because
it works.
2013-01-27 06:12:35 +02:00
..
base_helpers.rb Extract out gem related code to Pry::Rubygem 2013-01-09 00:24:53 +02:00
command_helpers.rb Extract out gem related code to Pry::Rubygem 2013-01-09 00:24:53 +02:00
documentation_helpers.rb Highlight code in comments as ruby regardless 2012-07-09 15:20:29 -07:00
options_helpers.rb Fix the superficial slop errors 2012-05-29 20:33:52 -07:00
table.rb Helpers::tablify: fix FloatDomainError 2013-01-27 06:12:35 +02:00
text.rb Add missing brackets to function definitions 2012-11-29 09:51:10 -08:00