File Coverage

blib/lib/Mojo/Collection/Role/Extra.pm
Criterion Covered Total %
statement 13 13 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod 1 1 100.0
total 17 17 100.0


line stmt bran cond sub pod time code
1             package Mojo::Collection::Role::Extra ;
2             $Mojo::Collection::Role::Extra::VERSION = '0.015';
3 3     3   3878 use Role::Tiny;
  3         8  
  3         21  
4              
5             sub common {
6 8     8 1 37391 my $c = shift;
7 8         31 my $size = $c->size;
8 8         64 my $current_node = $c->first;
9 8         49 my $parent_node;
10             my $enclosed;
11 8         14 do {
12 16         91 $parent_node = $current_node->parent;
13 16     247   846 $enclosed = $c->grep(sub { $parent_node->is_ancestor_to($_) } );
  247         1264  
14 16         192 $current_node = $parent_node;
15             } while ($size > $enclosed->size);
16              
17 8         74 return $parent_node;
18             }
19              
20             1; # Magic true value
21             # ABSTRACT: provides methods for use with Mojo::DOM::Role::Analyzer
22              
23             __END__