Navigation Menu

Skip to content

Commit

Permalink
no need for an extra line
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Mar 3, 2015
1 parent 270cfb3 commit 77c6b1f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions lib/Mojo/Util.pm
Expand Up @@ -276,8 +276,7 @@ sub tablify {
my @spec;
for my $row (@$rows) {
for my $i (0 .. $#$row) {
$row->[$i] //= '';
$row->[$i] =~ s/[\r\n]//g;
($row->[$i] //= '') =~ s/[\r\n]//g;
my $len = length $row->[$i];
$spec[$i] = $len if $len >= ($spec[$i] // 0);
}
Expand Down
3 changes: 1 addition & 2 deletions t/mojo/util.t
Expand Up @@ -468,8 +468,7 @@ is tablify([[undef, 'yada'], ['yada', undef]]), " yada\nyada \n",
'right result';
is tablify([['foo', 'bar', 'baz'], ['yada', 'yada', 'yada']]),
"foo bar baz\nyada yada yada\n", 'right result';
is tablify([['a', '', 'b'], ['c', '', 'd']]), "a b\nc d\n",
'right result';
is tablify([['a', '', 0], [0, '', 'b']]), "a 0\n0 b\n", 'right result';

# deprecated
{
Expand Down

0 comments on commit 77c6b1f

Please sign in to comment.