File Coverage

blib/lib/DDG/ZeroClickInfo/Spice/Data.pm
Criterion Covered Total %
statement 7 7 100.0
branch 1 2 50.0
condition n/a
subroutine 2 2 100.0
pod 1 1 100.0
total 11 12 91.6


line stmt bran cond sub pod time code
1             package DDG::ZeroClickInfo::Spice::Data;
2             our $AUTHORITY = 'cpan:DDG';
3             # ABSTRACT: Data that gets delivered additional to the spice call into the Javascript of the HTML
4             $DDG::ZeroClickInfo::Spice::Data::VERSION = '1016';
5 12     12   43 use Moo;
  12         12  
  12         48  
6              
7              
8             has data => (
9             is => 'ro',
10             required => 1,
11             );
12              
13              
14             sub add_data {
15 2     2 1 2 my ( $self, $data ) = @_;
16 2 50       5 die "can only handle DDG::ZeroClickInfo::Spice::Data" unless ref $data eq 'DDG::ZeroClickInfo::Spice::Data';
17 2         1 $self->data->{$_} = $data->data->{$_} for (keys %{$data->data});
  2         13  
18             }
19              
20             1;
21              
22             __END__