Commit | Line | Data |
f20e0e9e |
1 | use MooseX::Declare; |
2 | |
3 | class IronMunger::Monger { |
4 | |
f00c97c5 |
5 | use MooseX::Types::Moose qw(ArrayRef Str); |
f20e0e9e |
6 | use IronMunger::Calculate qw(:all); |
7 | use aliased 'IronMunger::Post'; |
8 | use signatures; |
9 | |
f00c97c5 |
10 | has name => (is => 'ro', isa => Str, required => 0, predicate => 'has_name'); |
11 | has nick => (is => 'ro', isa => Str, required => 0, predicate => 'has_nick'); |
12 | |
f20e0e9e |
13 | has posts => ( |
14 | is => 'ro', isa => ArrayRef[Post], required => 1, |
15 | default => sub { [] }, |
16 | ); |
17 | |
18 | has post_count => ( |
19 | is => 'ro', lazy => 1, |
20 | default => sub ($self) { successful_sequential_posts(@{$self->posts}) }, |
21 | ); |
22 | |
23 | has days_left => ( |
24 | is => 'ro', lazy => 1, |
25 | default => sub ($self) { days_remaining_to_post(@{$self->posts}) }, |
26 | ); |
79810d7d |
27 | |
28 | has level => ( |
29 | is => 'ro', lazy => 1, |
30 | default => sub ($self) { level_for_post_count($self->post_count) } |
31 | ); |
f20e0e9e |
32 | } |
33 | |
34 | 1; |