line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Minilla::Gitignore; |
2
|
1
|
|
|
1
|
|
1003
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
40
|
|
4
|
1
|
|
|
1
|
|
5
|
use utf8; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
614
|
use Moo; |
|
1
|
|
|
|
|
11206
|
|
|
1
|
|
|
|
|
5
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has lines => ( |
9
|
|
|
|
|
|
|
is => 'rw', |
10
|
|
|
|
|
|
|
default => sub { +[ ] }, |
11
|
|
|
|
|
|
|
); |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
1537
|
no Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub load { |
16
|
0
|
|
|
0
|
0
|
|
my ($class, $filename) = @_; |
17
|
|
|
|
|
|
|
|
18
|
0
|
0
|
|
|
|
|
open my $fh, '<', $filename |
19
|
|
|
|
|
|
|
or die "Cannot open $filename: $!"; |
20
|
0
|
|
|
|
|
|
my @lines; |
21
|
0
|
|
|
|
|
|
while (defined($_ = <$fh>)) { |
22
|
0
|
|
|
|
|
|
chomp; |
23
|
0
|
|
|
|
|
|
push @lines, $_; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
return $class->new( |
27
|
|
|
|
|
|
|
lines => [@lines], |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub remove { |
32
|
0
|
|
|
0
|
0
|
|
my ($self, $pattern) = @_; |
33
|
0
|
0
|
|
|
|
|
if (ref $pattern) { |
34
|
0
|
|
|
|
|
|
$self->lines([grep { $_ !~ $pattern } @{$self->lines}]); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
} else { |
36
|
0
|
|
|
|
|
|
$self->lines([grep { $_ ne $pattern } @{$self->lines}]); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub add { |
41
|
0
|
|
|
0
|
0
|
|
my ($self, $pattern) = @_; |
42
|
|
|
|
|
|
|
|
43
|
0
|
0
|
|
|
|
|
unless (grep { $pattern eq $_ } @{$self->lines}) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
push @{$self->lines}, $pattern; |
|
0
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub as_string { |
49
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
50
|
0
|
|
|
|
|
|
return join('', map { "$_\n" } @{$self->lines}); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub save { |
54
|
0
|
|
|
0
|
0
|
|
my ($self, $filename) = @_; |
55
|
0
|
0
|
|
|
|
|
open my $fh, '>', $filename |
56
|
|
|
|
|
|
|
or die "Cannot open $filename: $!"; |
57
|
0
|
|
|
|
|
|
for (@{$self->lines}) { |
|
0
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
print {$fh} $_, "\n"; |
|
0
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
} |
60
|
0
|
|
|
|
|
|
close $fh; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |
64
|
|
|
|
|
|
|
|