diff options
Diffstat (limited to 'lib/DeWeave/Collection.pm')
-rw-r--r-- | lib/DeWeave/Collection.pm | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/DeWeave/Collection.pm b/lib/DeWeave/Collection.pm new file mode 100644 index 0000000..803a8cc --- /dev/null +++ b/lib/DeWeave/Collection.pm @@ -0,0 +1,30 @@ +package DeWeave::Collection; +use Moose; +use namespace::autoclean; +use MooseX::Types::Moose qw(ArrayRef Int Str Num); +use JSON::Any; +use DeWeave::EDO; + +has items => ( + isa => ArrayRef['DeWeave::WBO'], + is => 'ro', + required => 1, +); + +sub from_json { + my ($class,$json,$crypt)=@_; + + my $j = JSON::Any->new; + + my $args = $j->decode($json); + use Data::Dump 'pp';warn pp $args; + + my @items = map { + DeWeave::EDO->new({%$_,__crypt=>$crypt}) + } @$args; + return $class->new({ + items => \@items, + }); +} + +1; |