line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package GraphQL::Role::Named; |
2
|
|
|
|
|
|
|
|
3
|
18
|
|
|
18
|
|
13471
|
use 5.014; |
|
18
|
|
|
|
|
67
|
|
4
|
18
|
|
|
18
|
|
100
|
use strict; |
|
18
|
|
|
|
|
39
|
|
|
18
|
|
|
|
|
3512
|
|
5
|
18
|
|
|
18
|
|
94
|
use warnings; |
|
18
|
|
|
|
|
38
|
|
|
18
|
|
|
|
|
489
|
|
6
|
18
|
|
|
18
|
|
94
|
use Moo::Role; |
|
18
|
|
|
|
|
36
|
|
|
18
|
|
|
|
|
126
|
|
7
|
18
|
|
|
18
|
|
7623
|
use Types::Standard -all; |
|
18
|
|
|
|
|
44
|
|
|
18
|
|
|
|
|
146
|
|
8
|
18
|
|
|
18
|
|
846846
|
use GraphQL::MaybeTypeCheck; |
|
18
|
|
|
|
|
48
|
|
|
18
|
|
|
|
|
175
|
|
9
|
18
|
|
|
18
|
|
115
|
use GraphQL::Type::Library qw(StrNameValid); |
|
18
|
|
|
|
|
39
|
|
|
18
|
|
|
|
|
154
|
|
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
|
|
9630
|
my ($self) = @_; |
52
|
41
|
|
|
|
|
705
|
$self->name; |
53
|
|
|
|
|
|
|
}); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
method _from_ast_named( |
56
|
|
|
|
|
|
|
HashRef $ast_node, |
57
|
105
|
50
|
|
105
|
|
273
|
) { |
|
105
|
50
|
|
|
|
215
|
|
|
105
|
50
|
|
|
|
151
|
|
|
105
|
|
|
|
|
175
|
|
|
105
|
|
|
|
|
227
|
|
|
105
|
|
|
|
|
650
|
|
58
|
|
|
|
|
|
|
( |
59
|
|
|
|
|
|
|
name => $ast_node->{name}, |
60
|
105
|
100
|
|
|
|
984
|
($ast_node->{description} ? (description => $ast_node->{description}) : ()), |
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable(); |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |