add Monger object
Matt S Trout [Fri, 15 May 2009 00:03:47 +0000 (01:03 +0100)]
lib/IronMunger/Monger.pm [new file with mode: 0644]

diff --git a/lib/IronMunger/Monger.pm b/lib/IronMunger/Monger.pm
new file mode 100644 (file)
index 0000000..ec0683d
--- /dev/null
@@ -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;