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 = '1017';
5 12     12   68 use Moo;
  12         26  
  12         60  
6              
7              
8             has data => (
9             is => 'ro',
10             required => 1,
11             );
12              
13              
14             sub add_data {
15 2     2 1 6 my ( $self, $data ) = @_;
16 2 50       8 die "can only handle DDG::ZeroClickInfo::Spice::Data" unless ref $data eq 'DDG::ZeroClickInfo::Spice::Data';
17 2         3 $self->data->{$_} = $data->data->{$_} for (keys %{$data->data});
  2         14  
18             }
19              
20             1;
21              
22             __END__