package App::Commentry::MappedSet;

use Moo;

has source => (is => 'ro', required => 1);
has mapping => (is => 'ro', required => 1);

sub flatten {
  my ($self) = @_;
  map $self->mapping->($_), $self->source->flatten;
}

sub to_stream {
  require HTML::Zoom::ArrayStream;
  HTML::Zoom::ArrayStream->new({ array => [ $_[0]->flatten ] });
}

1;
