Skip to content
Browse files

Render to a string instead of to stdout

  • Loading branch information...
1 parent 117120e commit 5f23a820e48a18668a18258e44d282dcbd3e1644 @tene tene committed Jun 9, 2010
Showing with 6 additions and 1 deletion.
  1. +6 −1 lib/Ratel.pm
View
7 lib/Ratel.pm
@@ -13,9 +13,14 @@ class Ratel {
$!compiled = $source.subst(/(['%]' | ^ ] .*? [ $ | '[%' ])/, {";\$.emit-hunk({$index++});"}, :g);
}
method emit-hunk(Int $i) {
- print @.hunks[$i][0];
+ $.emit(@.hunks[$i][0]);
+ }
+ method emit($t) {
+ $*RESULT ~= $t;
}
method do(*%attrs) {
+ my $*RESULT = '';
eval $.compiled;
+ return $*RESULT;
}
}

0 comments on commit 5f23a82

Please sign in to comment.
Something went wrong with that request. Please try again.