line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package GraphQL::Role::Named; |
2
|
|
|
|
|
|
|
|
3
|
18
|
|
|
18
|
|
14046
|
use 5.014; |
|
18
|
|
|
|
|
67
|
|
4
|
18
|
|
|
18
|
|
97
|
use strict; |
|
18
|
|
|
|
|
34
|
|
|
18
|
|
|
|
|
409
|
|
5
|
18
|
|
|
18
|
|
81
|
use warnings; |
|
18
|
|
|
|
|
36
|
|
|
18
|
|
|
|
|
495
|
|
6
|
18
|
|
|
18
|
|
85
|
use Moo::Role; |
|
18
|
|
|
|
|
32
|
|
|
18
|
|
|
|
|
142
|
|
7
|
18
|
|
|
18
|
|
7301
|
use Types::Standard -all; |
|
18
|
|
|
|
|
38
|
|
|
18
|
|
|
|
|
131
|
|
8
|
18
|
|
|
18
|
|
791663
|
use GraphQL::MaybeTypeCheck; |
|
18
|
|
|
|
|
50
|
|
|
18
|
|
|
|
|
189
|
|
9
|
18
|
|
|
18
|
|
106
|
use GraphQL::Type::Library qw(StrNameValid); |
|
18
|
|
|
|
|
39
|
|
|
18
|
|
|
|
|
180
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 NAME |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
GraphQL::Role::Named - GraphQL "named" object role |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 SYNOPSIS |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
with qw(GraphQL::Role::Named); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 DESCRIPTION |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
Allows type constraints for named objects, providing also C<name> and |
24
|
|
|
|
|
|
|
C<description> attributes. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head2 name |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=cut |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
has name => (is => 'ro', isa => StrNameValid, required => 1); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head2 description |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Optional description. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=cut |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
has description => (is => 'ro', isa => Str); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 METHODS |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head2 to_string |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Part of serialisation. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=cut |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
has to_string => (is => 'lazy', isa => Str, init_arg => undef, builder => sub { |
51
|
41
|
|
|
41
|
|
8542
|
my ($self) = @_; |
52
|
41
|
|
|
|
|
668
|
$self->name; |
53
|
|
|
|
|
|
|
}); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
method _from_ast_named( |
56
|
|
|
|
|
|
|
HashRef $ast_node, |
57
|
105
|
50
|
|
105
|
|
350
|
) { |
|
105
|
50
|
|
|
|
247
|
|
|
105
|
50
|
|
|
|
187
|
|
|
105
|
|
|
|
|
208
|
|
|
105
|
|
|
|
|
236
|
|
|
105
|
|
|
|
|
686
|
|
58
|
|
|
|
|
|
|
( |
59
|
|
|
|
|
|
|
name => $ast_node->{name}, |
60
|
105
|
100
|
|
|
|
1168
|
($ast_node->{description} ? (description => $ast_node->{description}) : ()), |
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable(); |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |