blib/lib/BioX/Workflow/Command/run/Rules/Directives/Types/Stash.pm

filter: Statementstmt 77.7% 7 / 9 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 83.3% 10 / 12 CC 1 SCAR 0.9
CC
1
Cov
78%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« blib/lib/BioX/Workflow/Command/Utils/Log.pm ↑ Summary blib/lib/BioX/Workflow/Command/run/Rules/Rules.pm »
1 package BioX::Workflow::Command::run::Rules::Directives::Types::Stash;
2  
3 1 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use Data::Merger qw(merger);
Subroutine BEGIN: called CC=1 SCAR=2.6
7  
8 =head2 stash
9  
10 This isn't ever used in the code. Its just there incase you want to persist objects across rules
11  
12 It uses Moose::Meta::Attribute::Native::Trait::Hash and supports all the methods.
13  
14 set_stash => 'set',
15 get_stash => 'get',
16 has_no_stash => 'is_empty',
17 num_stashs => 'count',
18 delete_stash => 'delete',
19 stash_pairs => 'kv',
20  
21 =cut
22  
23 has 'stash' => (
24 is => 'rw',
25 isa => 'HashRef',
26 traits => ['Hash'],
27 default => sub { {} },
28 handles => {
29 set_stash => 'set',
30 get_stash => 'get',
31 has_no_stash => 'is_empty',
32 num_stashs => 'count',
33 delete_stash => 'delete',
34 stash_pairs => 'kv',
35 },
36 );
37  
38 sub merge_stash {
39 my $self = shift;
40 my $target = shift;
41  
42 my $merged_data = merger( $target, $self->stash );
43 $self->stash($merged_data);
44 }
45  
46 # no Moose;
47 no Moose::Role;
48  
49 1;
« blib/lib/BioX/Workflow/Command/Utils/Log.pm ↑ Summary blib/lib/BioX/Workflow/Command/run/Rules/Rules.pm »