From: Matt S Trout Date: Fri, 15 May 2009 00:03:47 +0000 (+0100) Subject: add Monger object X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f20e0e9ece4c16075edf79c1e1f04c8aab31f17a;p=engit%2FIron-Munger.git add Monger object --- diff --git a/lib/IronMunger/Monger.pm b/lib/IronMunger/Monger.pm new file mode 100644 index 0000000..ec0683d --- /dev/null +++ b/lib/IronMunger/Monger.pm @@ -0,0 +1,26 @@ +use MooseX::Declare; + +class IronMunger::Monger { + + use MooseX::Types::Moose qw(ArrayRef); + use IronMunger::Calculate qw(:all); + use aliased 'IronMunger::Post'; + use signatures; + + has posts => ( + is => 'ro', isa => ArrayRef[Post], required => 1, + default => sub { [] }, + ); + + has post_count => ( + is => 'ro', lazy => 1, + default => sub ($self) { successful_sequential_posts(@{$self->posts}) }, + ); + + has days_left => ( + is => 'ro', lazy => 1, + default => sub ($self) { days_remaining_to_post(@{$self->posts}) }, + ); +} + +1;