Skip to content

Instantly share code, notes, and snippets.

@MattOates
Last active May 9, 2017 13:52
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 MattOates/363ce81f463f643709e5c69b4e641f38 to your computer and use it in GitHub Desktop.
Save MattOates/363ce81f463f643709e5c69b4e641f38 to your computer and use it in GitHub Desktop.
Add in a new decoding for Blob/Buf
my class 2bit does Blob[uint8] is repr('VMArray') {
method decode(2bit:D: $encoding = '2bit') {
die "Can not decode a 2bit buffer as if it were $encoding"
unless $enc eq '2bit';
#TODO the guts here
}
method encoding() { '2bit' }
multi method Str(2bit:D:) { self.decode }
multi method Stringy(2bit:D:) { self.decode }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment