Skip to content

Commit 672b9cf

Browse files
committed
Comment and constrain instance methods
1 parent 66bad3f commit 672b9cf

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/Terminal/Widgets/Volatile/DirTree.rakumod

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ role Node {
77
has IO::Path:D() $.path is required;
88
has Node $.parent;
99

10-
method gist() {
10+
11+
#| Simplified gist that does not traverse parents
12+
method gist(::?CLASS:D:) {
1113
my $short-name = self.^name.subst('Terminal::Widgets::Volatile::', '');
1214
$short-name ~ ':' ~ $!path.path
1315
}
@@ -22,7 +24,9 @@ class File does Node {
2224
class SymLink does Node {
2325
has IO::Path:D() $.target is required;
2426

25-
method gist() {
27+
28+
#| Standard node gist plus target
29+
method gist(::?CLASS:D:) {
2630
self.Node::gist ~ ' => ' ~ $!target.path
2731
}
2832
}
@@ -31,7 +35,9 @@ class Dir does Node {
3135
has Node:D @!children is built;
3236
has Instant:D $.cache-time .= from-posix-nanos(0);
3337

34-
method children(Bool:D :$refresh = False) {
38+
39+
#| Lazily find (and cache) children, forcing a refresh if requested
40+
method children(::?CLASS:D: Bool:D :$refresh = False) {
3541
# XXXX: For now, just fake real caching and be lazy
3642
if $refresh || !$!cache-time {
3743
$!cache-time = now;

0 commit comments

Comments
 (0)