Skip to content

Commit

Permalink
implement Array ~~ Hash
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz committed Jul 19, 2009
1 parent e759b14 commit d99b5b8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/setting/Hash.pm
Expand Up @@ -8,6 +8,17 @@ class Hash is also {
@.keys.sort eqv %topic.keys.sort;
}

# the spec says Array, not Positional, so we can't use the @ sigil here
multi method ACCEPTS(Array $topic) {
# we can't simply write
# $.contains(any(@($topic)))
# because .contains doesn't autothread, so we have to do it manually:
for $topic.list {
return Bool::True if $.exists($_);
}
Bool::False;
}

multi method ACCEPTS($topic) {
$.contains($topic)
}
Expand Down

0 comments on commit d99b5b8

Please sign in to comment.