Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Commit

Permalink
Support 'ORed' lookups with ARRAYs
Browse files Browse the repository at this point in the history
In the case of 'attr => [a, b, c]', allow any of 'a', 'b', or 'c' to be
satisfied in order to satisfy the attribute.
  • Loading branch information
GuiltyDolphin committed Jun 14, 2016
1 parent 17ee18c commit c52d2dc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/DDG/Meta/Data.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use Path::Class;
use File::ShareDir 'dist_file';
use LWP::UserAgent;
use File::Copy::Recursive 'pathmk';
use List::Util qw( pairs );
use List::Util qw( any pairs );

use strict;

Expand Down Expand Up @@ -140,7 +140,11 @@ sub filter_ias {
foreach (pairs @$lookups) {
return () unless @results;
my ($by, $lookup) = @$_;
@results = grep { _satisfy($_, $by, $lookup) } @results;
my @lookup = ref $lookup eq 'ARRAY' ? @$lookup : ($lookup);
@results = grep {
my $ia = $_;
any { _satisfy($ia, $by, $_) } @lookup;
} @results;
}
return \@results;
}
Expand Down

0 comments on commit c52d2dc

Please sign in to comment.