Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make sure Mix.WHICH is value based, and on demand
  • Loading branch information
lizmat committed May 16, 2014
1 parent b700214 commit 94bd372
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/core/Mix.pm
@@ -1,5 +1,12 @@
my class Mix does Mixy {
has Real $!total;
has $!WHICH;

submethod WHICH {
$!WHICH //= self.^name
~ '|'
~ %!elems.keys.sort.map( { $_ ~ '(' ~ %!elems{$_}.value ~ ')' } );
}

method total (--> Real) { $!total //= [+] self.values }
method at_key($k --> Real) {
Expand Down

0 comments on commit 94bd372

Please sign in to comment.