File Coverage

lib/Finance/Dogechain/Block.pm
Criterion Covered Total %
statement 6 19 31.5
branch n/a
condition n/a
subroutine 2 5 40.0
pod 1 3 33.3
total 9 27 33.3


line stmt bran cond sub pod time code
1             package Finance::Dogechain::Block;
2             $Finance::Dogechain::Block::VERSION = '1.20210524.0142';
3 1     1   8 use Mojo::Base -base, -signatures, 'Finance::Dogechain::Base';
  1         2  
  1         7  
4 1     1   810 use Finance::Dogechain::Transaction;
  1         2  
  1         8  
5              
6             has 'block_id';
7             has 'block', sub($self) {
8             my $block = $self->return_field_if_success( '/block/' . $self->block_id, 'block' );
9              
10             convert_transactions_in_place( $block->{txs} ) if $block;
11              
12             return $block;
13             };
14              
15 0     0 0   sub convert_transactions_in_place($txs) {
  0            
  0            
16 0           while (my ($i, $tx_id) = each @$txs) {
17 0           $txs->[$i] = Finance::Dogechain::Transaction->new( tx_id => $tx_id );
18             }
19             }
20              
21 0     0 0   sub transactions($self) {
  0            
  0            
22 0           return $self->block->{txs};
23             }
24              
25 0     0 1   sub TO_JSON($self) {
  0            
  0            
26 0           return '[Finance::Dogechain::Block](block_id => ' . $self->block_id . ')';
27             }
28              
29             'to the moon';
30             __END__