Skip to content

Instantly share code, notes, and snippets.

@librasteve
Last active December 27, 2024 14:40
Show Gist options
  • Save librasteve/af74f120d9d15a6ead33d0f1b0dc65b5 to your computer and use it in GitHub Desktop.
Save librasteve/af74f120d9d15a6ead33d0f1b0dc65b5 to your computer and use it in GitHub Desktop.
MyCromps.rakumod
class Cell {
has $.data;
multi method new($data) {
$.new: :$data
}
method RENDER {
q:to/END/
<td><.data></td>
END
}
}
class Row {
has Cell() @.cells;
multi method new(@cells) {
$.new: :@cells
}
method RENDER {
q:to/END/
<tr>
<@.cells: $c>
<&Cell($c)>
</@>
</tr>
END
}
}
class MyTable is export {
has Row() @.rows;
multi method new(@rows) {
$.new: :@rows
}
method RENDER {
q:to/END/
<table border=1>
<@.rows: $r>
<&Row($r)>
</@>
</table>
END
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment