line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Ordeal::Model::Backend::YAML; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# vim: ts=3 sts=3 sw=3 et ai : |
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
2377
|
use 5.020; |
|
2
|
|
|
|
|
6
|
|
6
|
2
|
|
|
2
|
|
11
|
use strict; # redundant, but still useful to document |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
42
|
|
7
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
107
|
|
8
|
|
|
|
|
|
|
{ our $VERSION = '0.003'; } |
9
|
2
|
|
|
2
|
|
13
|
use Mo qw< default builder >; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
10
|
|
10
|
2
|
|
|
2
|
|
2031
|
use Ouch; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
16
|
|
11
|
2
|
|
|
2
|
|
144
|
use Path::Tiny; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
93
|
|
12
|
2
|
|
|
2
|
|
1201
|
use YAML::Tiny qw< LoadFile >; |
|
2
|
|
|
|
|
11809
|
|
|
2
|
|
|
|
|
130
|
|
13
|
2
|
|
|
2
|
|
509
|
use autodie; |
|
2
|
|
|
|
|
15622
|
|
|
2
|
|
|
|
|
11
|
|
14
|
|
|
|
|
|
|
|
15
|
2
|
|
|
2
|
|
12558
|
use experimental qw< signatures postderef >; |
|
2
|
|
|
|
|
13
|
|
|
2
|
|
|
|
|
13
|
|
16
|
2
|
|
|
2
|
|
385
|
no warnings qw< experimental::signatures experimental::postderef >; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
117
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
extends 'Ordeal::Model::Backend::PlainFile'; |
19
|
|
|
|
|
|
|
|
20
|
2
|
|
|
2
|
|
13
|
use Ordeal::Model::Deck; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
605
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has _decks => (is => 'rw', lazy => 1, builder => '_build_decks'); |
23
|
|
|
|
|
|
|
|
24
|
2
|
|
|
2
|
1
|
15
|
sub deck ($self, $id) { |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
5
|
|
25
|
2
|
100
|
|
|
|
6
|
my $d = $self->_decks->{$id} or ouch 404, "not found: deck '$id'"; |
26
|
1
|
|
|
|
|
21
|
$_ = $self->card($_) for $d->{cards}->@*; # turn cards into Cards |
27
|
1
|
|
|
|
|
29
|
return Ordeal::Model::Deck->new( |
28
|
|
|
|
|
|
|
name => $id, # default value |
29
|
|
|
|
|
|
|
group => '', # default value |
30
|
|
|
|
|
|
|
$d->%*, # whatever was read |
31
|
|
|
|
|
|
|
id => $id, # this overrides whatever is in $d->%* |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
0
|
1
|
0
|
sub decks ($self) { keys $self->_decks->%* } |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
36
|
|
|
|
|
|
|
|
37
|
1
|
|
|
1
|
|
10
|
sub _build_decks ($s) { |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
2
|
|
38
|
1
|
|
|
|
|
6
|
return LoadFile(path($s->base_directory, 'decks.yml')->stringify); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
__END__ |