1. my class Encoding::Encoder::TranslateNewlineWrapper does Encoding::Encoder {
  2. has Encoding::Encoder $!delegate;
  3. method new(Encoding::Encoder $delegate) {
  4. nqp::create(self)!setup($delegate)
  5. }
  6. method !setup(Encoding::Encoder $delegate) {
  7. $!delegate := $delegate;
  8. self
  9. }
  10. method encode-chars(Str:D $str --> Blob:D) {
  11. $!delegate.encode-chars(Rakudo::Internals.TRANSPOSE($str, "\n", "\r\n"))
  12. }
  13. }