Skip to content

Commit bb38add

Browse files
committed
Define sort order in Categories.categories-list
1 parent 0b4110f commit bb38add

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/Examples/Categories.pm

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ class Categories is export {
1616
has %.categories;
1717

1818
submethod TWEAK {
19-
for %!categories-table.keys -> $category-key {
20-
%!categories{$category-key} = Category.new(
21-
key => $category-key,
22-
title => %!categories-table{$category-key},
19+
for %!categories-table.kv -> $key, $title {
20+
%!categories{$key} = Category.new(
21+
:$key,
22+
:$title,
2323
);
2424
}
2525
}
2626

2727
method categories-list {
28-
return %!categories.values;
28+
return %!categories.pairs.sort.map(*.value);
2929
}
3030

3131
method append-subcategories(:$to-category, :$subcategories) {

0 commit comments

Comments
 (0)