-
-
Save colomon/b598829a9419bdb5a2ed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
role HwDumpObject { | |
has $.id; | |
has %.attributes; | |
method initialize-attributes(@raw-attributes) { | |
for @raw-attributes -> $attribute { | |
warn "Strange number of keys in attribute" if $attribute.keys != 1; | |
my $key = $attribute.keys[0]; | |
warn "Attribute $key found more than once" if %.attributes{$key}; | |
%.attributes{$key} = $attribute{$key}; | |
} | |
$.id = %.attribute<ID> // "no id"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment