File Coverage

blib/lib/Mojolicious/Plugin/LinkEmbedder/Link/Video/AppearIn.pm
Criterion Covered Total %
statement 3 11 27.2
branch 0 4 0.0
condition 0 4 0.0
subroutine 1 4 25.0
pod 0 3 0.0
total 4 26 15.3


line stmt bran cond sub pod time code
1             package Mojolicious::Plugin::LinkEmbedder::Link::Video::AppearIn;
2 1     1   2796 use Mojo::Base 'Mojolicious::Plugin::LinkEmbedder::Link';
  1         3  
  1         6  
3              
4             has media_id => sub {
5             my $self = shift;
6              
7             return '' if defined $self->url->path->[1];
8             return $self->url->path->[0] || '';
9             };
10              
11 0     0 0   sub provider_name {'appear.in'}
12              
13             sub learn {
14 0     0 0   my ($self, $c, $cb) = @_;
15              
16 0 0         return $self->$cb if $self->media_id;
17 0           return $self->SUPER::learn($c, $cb);
18             }
19              
20             sub to_embed {
21 0     0 0   my $self = shift;
22 0 0         my $media_id = $self->media_id or return $self->SUPER::to_embed;
23 0           my %args = @_;
24              
25             $self->_iframe(
26             src => "https://appear.in/$media_id",
27             class => 'link-embedder video-appearin',
28             width => $args{width} || 740,
29 0   0       height => $args{height} || 390
      0        
30             );
31             }
32              
33             1;