From: Matt S Trout Date: Wed, 20 Jan 2010 11:04:22 +0000 (+0000) Subject: perl set object X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5c693245a78668b191ddb6bfa2431183790b1d85;p=dbsrgits%2FDBIx-Data-Store-old.git perl set object --- diff --git a/lib/Data/Perl/Collection/Set.pm b/lib/Data/Perl/Collection/Set.pm new file mode 100644 index 0000000..7415b9d --- /dev/null +++ b/lib/Data/Perl/Collection/Set.pm @@ -0,0 +1,21 @@ +package Data::Perl::Collection::Set; + +use Moose; +use Method::Signatures::Simple; +use Data::Perl::Stream::Array; + +has '_members' => (is => 'ro', required => 1, init_arg => 'members'); + +method map ($fun) { + (ref $self)->new( + members => [ map $fun->($_), @{$self->_members} ] + ) +} + +method as_stream { + Data::Perl::Stream::Array->new(array => [ @{$self->_members} ]) +} + +__PACKAGE__->meta->make_immutable; + +1;