Last active
December 27, 2024 14:40
-
-
Save librasteve/af74f120d9d15a6ead33d0f1b0dc65b5 to your computer and use it in GitHub Desktop.
MyCromps.rakumod
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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