blob: d3ab7f02a3694405b0fa850db2c13be9a98c674f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
package GitHub::Collector::Role::Graph::Query;
use Moose::Role;
has language => (
is => 'rw',
isa => 'Str',
predicate => 'has_language',
);
has location => (
is => 'rw',
isa => 'Str',
predicate => 'has_location',
);
has company => (
is => 'ro',
isa => 'Str',
predicate => 'has_company',
);
has country => (
is => 'ro',
isa => 'Str',
predicate => 'has_country',
);
sub build_query {
my $self = shift;
my $search = {};
foreach my $attr (qw/language location company country/) {
my $predicate = "has_$attr";
if ( $self->$predicate ) {
$search->{$attr} = $self->$attr;
}
}
return $search;
}
1;
|