Skip to content

Commit

Permalink
Impl Rakudo::Internals.SHORT-GIST
Browse files Browse the repository at this point in the history
A routine for use in error messages where we dump .gist of
values. It fetches the gist and trims it to 23 chars, if
it's too long.
  • Loading branch information
zoffixznet committed Jan 1, 2018
1 parent bf6451d commit de21da3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/core/Rakudo/Internals.pm
Expand Up @@ -603,6 +603,12 @@ my class Rakudo::Internals {
}
}

method SHORT-GIST(\thing) {
nqp::if(
nqp::isgt_i(nqp::chars(my str $gist = thing.gist), 23),
nqp::concat(nqp::substr($gist, 0, 20), '...'),
$gist);
}
method SUBSTR-START-OOR(\from,\max) {
X::OutOfRange.new(
:what('Start argument to substr'),
Expand Down

0 comments on commit de21da3

Please sign in to comment.