diff options
| author | Paul Buetow <paul@buetow.org> | 2023-02-12 13:40:36 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2023-02-12 13:40:36 +0200 |
| commit | e3807941a06c29e8db600b17a5fbd386e8849ac1 (patch) | |
| tree | 4f40bada6f51a73df6c4a4dec5f3c5d7d6ab9c84 | |
| parent | 7529cdce08fa461e42c7932985bd9448f8722e5f (diff) | |
add ideas
| -rw-r--r-- | src/guprecords.raku | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/guprecords.raku b/src/guprecords.raku index 1d8e6dc..3d0ccd1 100644 --- a/src/guprecords.raku +++ b/src/guprecords.raku @@ -47,7 +47,7 @@ class Aggregate { } class Aggregator { - has %.aggregates = { hostname => {}, os => {}, uname => {}, os-major => {} } + has Hash %.aggregates = { hostname => {}, os => {}, uname => {}, os-major => {} } method add-file(IO::Path:D :$file is readonly) { my Str $hostname = $file.IO.basename.split('.').first; @@ -73,17 +73,11 @@ class Aggregator { } } -class Reporter { - has %.aggregates is required; +role Sorting { + has Hash %.aggregates is required; has Cat $.cat is required; has SubCat $.sub-cat is required; - method report { - for self.sort-by($!sub-cat) -> $what { - $what.Str.say; - } - } - multi method sort-by('uptime') { self.sort-by: *.uptime } multi method sort-by('downtime') { self.sort-by: *.downtime } multi method sort-by('lifespan') { self.sort-by: *.lifespan } @@ -94,6 +88,14 @@ class Reporter { } } +class Reporter does Sorting { + method report { + for self.sort-by($!sub-cat) -> $what { + $what.Str.say; + } + } +} + sub MAIN( Str :$stats-dir is required, #= The uptimed raw record input dir. Cat :$cat = 'hostname'; #= Category, one of hostname, os os-major and uname. |
