File Coverage: lib/Yukki/Role/App.pm

# File Coverage

File: | lib/Yukki/Role/App.pm
Coverage: | 100.0%

line | stmt | bran | cond | sub | pod | time | code
--- | --- | --- | --- | --- | --- | --- | ---
1 |  |  |  |  |  |  | package Yukki::Role::App;
2 |
3 | 7 7 |  |  | 7 |  | 45916 17 | use v5.24;
4 | 7 7 7 |  |  | 7 |  | 25 9 32 | use utf8;
5 | 7 7 7 |  |  | 7 |  | 88 21 29 | use Moo::Role;
6 |
7 |  |  |  |  |  |  | requires qw(
8 |  |  |  |  |  |  | model
9 |  |  |  |  |  |  | view
10 |  |  |  |  |  |  | controller
11 |  |  |  |  |  |  | locate
12 |  |  |  |  |  |  | locate_dir
13 |  |  |  |  |  |  | check_access
14 |  |  |  |  |  |  | );
15 |
16 |  |  |  |  |  |  | # ABSTRACT: the role Yukki app-classes implement
17 |
18 - 74 |  |
    =head1 DESCRIPTION

    The L<Yukki> and L<Yukki::Web> classes fulfill this role.

    =head1 REQUIRED METHODS

    =head2 model

      my $obj = $self->model($name, \%params);

    Given a name and an optional hash of parameters, return an instance of a
    L<Yukki::Model>.

    =head2 view

      my $obj = $self->view($name);

    Given a name, return a view object.

    =head2 controller

      my $obj = $self->controller($name);

    Given a name, return a controller object.

    =head2 locate

      my $file = $self->locate($base_path, @path_parts);

    Given a configuration key in C<$base_path> and some C<@path_parts> to append,
    return a L<Path::Class::File> representing that file under the Yukki
    installation.

    =head2 locate_dir

      my $dir = $self->locate_dir($base_path, @path_parts);

    Given a configuration key in C<$base_path> and some C<@path_parts> to append,
    return a L<Path::Class::Dir> representing that directory under the Yukki
    installation.

    =head2 check_access

      my $access_is_ok = $self->check_access({
          user       => $user,
          repository => $repository,
          needs      => $needs,
      });

    The C<user> is optional. It should be an object returned from
    L<Yukki::Model::User>. The C<repository> is required and should be the name of
    the repository the user is trying to gain access to. The C<needs> is the access
    level the user needs. It must be an L<Yukki::Types/AccessLevel>.

    The method returns a true value if access should be granted or false otherwise.

    =cut
75 |
76 |  |  |  |  |  |  | 1;