Skip to content

Instantly share code, notes, and snippets.

Created February 20, 2015 19:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/a58e4878c1d545f49575 to your computer and use it in GitHub Desktop.
Save anonymous/a58e4878c1d545f49575 to your computer and use it in GitHub Desktop.
submethod BUILD (*%data){
for self.^attributes.grep($_.name.substr(2) ~~ %data.keys) -> $attr {
%data{$attr.name.substr(2)}.say;
if $attr.type ~~ Resource {
$attr.set_value($attr.type.new(:id(%data{$attr.name.substr(2)})));
} else {
$attr.set_value(%data{$attr.name.substr(2)});
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment