File Coverage

blib/lib/Koha/Contrib/ValueBuilder/RepeatableAutocomplete.pm
Criterion Covered Total %
statement 9 29 31.0
branch n/a
condition 0 8 0.0
subroutine 3 7 42.8
pod 2 2 100.0
total 14 46 30.4


line stmt bran cond sub pod time code
1             package Koha::Contrib::ValueBuilder::RepeatableAutocomplete;
2 2     2   227684 use strict;
  2         3  
  2         59  
3 2     2   7 use warnings;
  2         4  
  2         108  
4 2     2   2148 use JSON qw(to_json);
  2         21915  
  2         15  
5              
6             # ABSTRACT: Repeatable autcomplete value-builder for Koha
7              
8             our $VERSION = '1.006'; # VERSION
9              
10             sub build_builder_inline {
11 0     0 1   my $class = shift;
12 0           my $args = shift;
13              
14             my $builder = sub {
15 0     0     my ($params) = @_;
16              
17             my $val = {
18             function_name => $params->{id},
19             data => to_json( $args->{data} ),
20             target => $args->{target},
21 0   0       minlength => $args->{minlength} // 3,
22             };
23              
24 0           my $res = <<'EOJS';
25            
69             EOJS
70 0   0       $res =~ s{\[%\s?(.*?)\s?%\]}{$val->{$1} // ''}eg;
  0            
71 0           return $res;
72 0           };
73 0           return { builder => $builder };
74             }
75              
76             sub build_builder_inline_multiple {
77 0     0 1   my $class = shift;
78 0           my $args = shift;
79              
80             my $builder = sub {
81 0     0     my ($params) = @_;
82              
83             my $val = {
84             function_name => $params->{id},
85             data => to_json( $args->{data} ),
86             target_map => to_json( $args->{target_map}),
87 0   0       minlength => $args->{minlength} // 3,
88             };
89              
90 0           my $res = <<'EOJS';
91            
139             EOJS
140 0   0       $res =~ s{\[%\s?(.*?)\s?%\]}{$val->{$1} // ''}eg;
  0            
141 0           return $res;
142 0           };
143 0           return { builder => $builder };
144             }
145              
146              
147              
148             q{ listening to: Fatima Spar & JOV: The Voice Within };
149              
150             __END__