File Coverage

lib/Finance/Dogechain/Block.pm
Criterion Covered Total %
statement 6 24 25.0
branch 0 2 0.0
condition n/a
subroutine 2 5 40.0
pod 2 3 66.6
total 10 34 29.4


line stmt bran cond sub pod time code
1             package Finance::Dogechain::Block;
2             $Finance::Dogechain::Block::VERSION = '1.20210418.2306';
3 1     1   8 use Mojo::Base -base, -signatures, 'Finance::Dogechain::Base';
  1         2  
  1         8  
4 1     1   767 use Finance::Dogechain::Transaction;
  1         2  
  1         10  
5              
6             has 'block_id';
7              
8 0     0 1   sub block($self) {
  0            
  0            
9 0           my $block = $self->return_field_if_success( '/block/' . $self->block_id, 'block' );
10 0           say JSON->new->pretty->encode( $block );
11              
12 0 0         if ($block) {
13 0           $self->convert_transactions_in_place( $block->{txs} );
14             }
15              
16 0           return $block;
17             }
18              
19 0     0 0   sub convert_transactions_in_place($self, $txs) {
  0            
  0            
  0            
20 0           while (my ($i, $tx_id) = each @$txs) {
21 0           $txs->[$i] = Finance::Dogechain::Transaction->new( tx_id => $tx_id );
22             }
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__