File Coverage

blib/lib/Articulate/Enrichment/DateUpdated.pm
Criterion Covered Total %
statement 22 22 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod 1 2 50.0
total 30 31 96.7


line stmt bran cond sub pod time code
1             package Articulate::Enrichment::DateUpdated;
2 4     4   4044 use strict;
  4         8  
  4         168  
3 4     4   21 use warnings;
  4         6  
  4         121  
4            
5 4     4   22 use Text::Markdown;
  4         40  
  4         179  
6 4     4   22 use Moo;
  4         8  
  4         29  
7            
8            
9             =head1 NAME
10            
11             Articulate::Enrichment::DateUpdated - add a update date to the meta
12            
13             =head1 METHODS
14            
15             =head3 enrich
16            
17             Sets the update date (C) to the current time.
18            
19             =cut
20            
21 4     4   2627 use DateTime;
  4         141341  
  4         420  
22            
23             sub now {
24 2     2 0 10 DateTime->now;
25             }
26            
27             sub enrich {
28 2     2 1 4 my $self = shift;
29 2         5 my $item = shift;
30 2         4 my $request = shift;
31 2         9 my $now = now;
32 2         484 $item->meta->{schema}->{core}->{dateUpdated} = "$now";
33 2         76 return $item;
34             }
35            
36             1;