Attean/Blank.pm

filter: Statementstmt 100% 33 / 33 Branchbran 100% 4 / 4 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 8 / 8 Podpod n/a totaltotal 95.8% 46 / 48 CC 4 SCAR 7.4
CC
4
Cov
97%
__ANON__
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.1
« Test/Attean/TripleStore.pm ↑ Summary Attean/API/Serializer.pm »
1 50 ▶use v5.14;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 50 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 =head1 NAME
5  
6 Attean::Blank - RDF blank nodes
7  
8 =head1 VERSION
9  
10 This document describes Attean::Blank version 0.040
11  
12 =head1 SYNOPSIS
13  
14 use v5.14;
15 use Attean;
16 my $term = Attean::Blank->new('b1');
17 $term->ntriples_string; # _:b1
18  
19 =head1 DESCRIPTION
20  
21 The Attean::Blank class represents RDF blank nodes.
22 It conforms to the L<Attean::API::Blank|Attean::API::Term> role.
23  
24 =head1 ROLES
25  
26 This role consumes L<Attean::API::Blank>, which provides the following methods:
27  
28 =over 4
29  
30 =item C<< value >>
31  
32 =back
33  
34 =cut
35  
36 50 package Attean::Blank 0.040 {
37 50 ▶ use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
38 50 ▶ use Types::Standard qw(Str);
Subroutine BEGIN: called CC=1 SCAR=0.0
39 50 ▶ use UUID::Tiny ':std';
Subroutine BEGIN: called CC=1 SCAR=0.0
40 50 ▶ use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
41
42 50 has 'value' => (is => 'ro', isa => Str, required => 1);
43 50 has 'ntriples_string' => (is => 'ro', isa => Str, lazy => 1, builder => '_ntriples_string');
44
45 50 with 'Attean::API::Blank';
46  
47 244 ▶ around BUILDARGS => sub {
Subroutine __ANON__: called CC=4 SCAR=13.9
48 244 my $orig = shift;
49 244 my $class = shift;
50
51 244 ▶ if (scalar(@_) == 0) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @_ == 0) { } 18 226 244
elsif (scalar @_ == 1) { } 214 12 226
52 18 my $uuid = unpack('H*', create_uuid());
53 18 return $class->$orig(value => 'b' . $uuid);
54 } elsif (scalar(@_) == 1) {
55 214 ▶ my $value = shift // '';
Condition50%1/2
shift() // ""
l!l
2140
MC/DC0%0/1
shift() // ""
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
56 214 return $class->$orig(value => $value);
57 }
58 12 return $class->$orig(@_);
59 50 };
60
61 160 ▶ sub _ntriples_string {
Subroutine _ntriples_string: called CC=1 SCAR=0.0
62 160 my $self = shift;
63 160 return '_:' . $self->value;
64 }
65 }
66  
67 50 1;
68  
69 __END__
« Test/Attean/TripleStore.pm ↑ Summary Attean/API/Serializer.pm »