File Coverage

blib/lib/Web/Library/Item.pm
Criterion Covered Total %
statement 1 3 33.3
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 2 4 50.0


line stmt bran cond sub pod time code
1             package Web::Library::Item;
2 1     1   3002 use Moose;
  0            
  0            
3             use Class::Load qw(load_class);
4             has name => (is => 'ro', isa => 'Str', required => 1);
5             has version => (is => 'ro', isa => 'Str', default => 'latest');
6              
7             sub BUILD {
8             my $self = shift;
9             load_class($self->get_package);
10             }
11              
12             sub get_package {
13             my $self = shift;
14             'Web::Library::' . $self->name;
15             }
16              
17             sub get_distribution_object {
18             my $self = shift;
19             $self->get_package->new;
20             }
21              
22             sub include_path {
23             my $self = shift;
24             $self->get_distribution_object->get_dir_for($self->version);
25             }
26              
27             sub css_assets {
28             my $self = shift;
29             $self->get_distribution_object->css_assets_for($self->version);
30             }
31              
32             sub javascript_assets {
33             my $self = shift;
34             $self->get_distribution_object->javascript_assets_for($self->version);
35             }
36             1;
37              
38             =pod
39              
40             =head1 NAME
41              
42             Web::Library::Item - A library item being managed by Web::Library
43              
44             =head1 SYNOPSIS
45              
46             # none; this class is internal
47              
48             =head1 DESCRIPTION
49              
50             This class represents a specific version of a specific library that is
51             managed by L<Web::Library>. It is internal; you should never need to
52             use it.