line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
1390
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
40
|
|
2
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
13
|
|
|
1
|
|
|
|
|
60
|
|
3
|
|
|
|
|
|
|
package Search::GIN::Extract::Attributes; |
4
|
|
|
|
|
|
|
our $VERSION = '0.10'; |
5
|
1
|
|
|
1
|
|
5
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
6
|
1
|
|
|
1
|
|
5304
|
use namespace::autoclean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
with qw( |
9
|
|
|
|
|
|
|
Search::GIN::Extract |
10
|
|
|
|
|
|
|
Search::GIN::Keys::Deep |
11
|
|
|
|
|
|
|
); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has attributes => ( |
14
|
|
|
|
|
|
|
isa => "ArrayRef[Str]", |
15
|
|
|
|
|
|
|
is => "rw", |
16
|
|
|
|
|
|
|
predicate => "has_attributes", |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub extract_values { |
20
|
3
|
|
|
3
|
0
|
7
|
my ( $self, $obj, @args ) = @_; |
21
|
|
|
|
|
|
|
|
22
|
3
|
|
|
|
|
7
|
my @meta_attrs = $self->get_meta_attrs($obj, @args); |
23
|
|
|
|
|
|
|
|
24
|
6
|
|
|
|
|
21
|
return $self->process_keys({ map { |
25
|
3
|
|
|
|
|
95
|
my $val = $_->get_value($obj); |
26
|
6
|
50
|
|
|
|
529
|
$_->name => (defined($val) ? $val : undef); |
27
|
|
|
|
|
|
|
} @meta_attrs }); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub get_meta_attrs { |
31
|
3
|
|
|
3
|
0
|
5
|
my ( $self, $obj, @args ) = @_; |
32
|
|
|
|
|
|
|
|
33
|
3
|
|
|
|
|
4
|
my $class = ref $obj; |
34
|
3
|
|
|
|
|
8
|
my $meta = Class::MOP::get_metaclass_by_name($class); |
35
|
|
|
|
|
|
|
|
36
|
3
|
50
|
|
|
|
111
|
if ( $self->has_attributes ) { |
37
|
0
|
|
|
|
|
0
|
return grep { defined } map { $meta->find_attribute_by_name($_) } @{ $self->attributes }; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
38
|
|
|
|
|
|
|
} else { |
39
|
3
|
|
|
|
|
8
|
return $meta->get_all_attributes; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |