Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 43 lines (37 sloc) 1.236 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
use v6;
use Hitomi::StreamEventKind;
use Hitomi::Output;

class Hitomi::Stream {
    has @!events;
    has $serializer;

    multi method new(@events, $serializer?) {
        return self.new(
            :events(@events),
            :serializer($serializer // Hitomi::XHTMLSerializer.new())
        );
    }

    # RAKUDO: We shouldn't have to provide this method. It should be handed
    # to us by C<Object>.
    multi method new(*%_) {
        return self.bless(self.CREATE(), |%_);
    }

    method Str() {
        # RAKUDO: A complex set of circumstances may cause the
        # array to have been nested one level too deeply at
        # this point. Compensating.
        @!events = @(@!events[0])
            while @!events.elems == 1 && @!events[0] ~~ Array;
        return $serializer.serialize(self);
    }

    method llist() {
        # RAKUDO: A complex set of circumstances may cause the
        # array to have been nested one level too deeply at
        # this point. Compensating.
        @!events = @(@!events[0])
            while @!events.elems == 1 && @!events[0] ~~ Array;
        return @!events;
    }

    method render($format, :$doctype) {
        return "";
    }
}
Something went wrong with that request. Please try again.