File Coverage

blib/lib/Data/Riak/Fast/MapReduce/Phase/Link.pm
Criterion Covered Total %
statement 6 12 50.0
branch 0 8 0.0
condition n/a
subroutine 2 3 66.6
pod 0 1 0.0
total 8 24 33.3


line stmt bran cond sub pod time code
1             package Data::Riak::Fast::MapReduce::Phase::Link;
2 22     22   151 use Mouse;
  22         45  
  22         126  
3              
4 22     22   6961 use JSON::XS ();
  22         8141  
  22         5092  
5              
6             # ABSTRACT: Link phase of a MapReduce
7              
8             with ('Data::Riak::Fast::MapReduce::Phase');
9              
10             =head1 DESCRIPTION
11              
12             A map/reduce link phase for Data::Riak::Fast
13              
14             =head1 SYNOPSIS
15              
16             my $lp = Data::Riak::Fast::MapReduce::Phase::Link->new(
17             bucket=> "foo",
18             tag => "friend",
19             keep => 0
20             );
21              
22             =head2 bucket
23              
24             The name of the bucket from which links should be followed.
25              
26             =cut
27              
28             has bucket => (
29             is => 'rw',
30             isa => 'Str',
31             predicate => 'has_bucket'
32             );
33              
34             has phase => (
35             is => 'ro',
36             isa => 'Str',
37             default => 'link'
38             );
39              
40             =head2 tag
41              
42             The name of the tag of links that should be followed
43              
44             =cut
45              
46             has tag => (
47             is => 'rw',
48             isa => 'Str',
49             predicate => 'has_tag'
50             );
51              
52             =head1 METHOD
53             =head2 pack()
54              
55             Serialize this link phase.
56              
57             =cut
58              
59             sub pack {
60 0     0 0   my $self = shift;
61              
62 0           my $href = {};
63              
64 0 0         $href->{keep} = $self->keep ? JSON::XS::true() : JSON::XS::false() if $self->has_keep;
    0          
65 0 0         $href->{bucket} = $self->bucket if $self->has_bucket;
66 0 0         $href->{tag} = $self->tag if $self->has_tag;
67              
68 0           $href;
69             }
70              
71             1;