add render method

This commit is contained in:
Nathan McCarty 2025-02-03 20:41:31 -05:00
parent 6d9e32bb12
commit 72607c7f25
4 changed files with 22 additions and 0 deletions

View file

@ -12,6 +12,9 @@ unit class PlaceholderPost does Post is json(:pretty);
#| cheaty way
has Bool:D $.placeholder = True;
#| An optional body for the placeholder post
has Str $.body;
method title(--> Str:D) {
"Placeholder Article"
}
@ -30,3 +33,8 @@ method empty(--> PlaceholderPost:D) {
method all-slugs(--> Array[Str:D]) {
Array[Str:D].new
}
# Return the body if there is one, the empty string if there isn't one
method render-html(--> Str:D) {
$!body // ''
}