bugfixes, tweaks, map support
[dbsrgits/DBIx-Data-Store.git] / lib / DBIx / Data / Collection / Set / Wrapper / Inflate.pm
index 0330181..b4d0b43 100644 (file)
@@ -29,11 +29,10 @@ sub clear { shift->_inner->clear }
 sub get {
   my ($self, $spec) = @_;
   my $inflator = $self->_inflator;
-  $inflator->inflate(
-    $self->_inner->get(
-      $inflator->deflate_spec($spec)
-    )
-  );
+  if (my $got = $self->_inner->get($inflator->deflate_spec($spec))) {
+    return $inflator->inflate($got);
+  }
+  return undef;
 }
 
 sub replace {
@@ -60,4 +59,11 @@ sub remove {
   $self->_inner->remove($self->_inflator->deflate_spec($spec));
 }
 
+sub map {
+  require DBIx::Data::Collection::Set::Mapped;
+  DBIx::Data::Collection::Set::Mapped->new({
+    inner => $_[0], mapper => $_[1]
+  });
+}
+
 1;