| 1 | package Druid::Filter::Logical::Not; | ||
| 2 | use Moo; | ||
| 3 | |||
| 4 | extends 'Druid::Filter::Logical'; | ||
| 5 | |||
| 6 | sub type { 'not' } | ||
| 7 | |||
| 8 | sub build { | ||
| 9 | my $self = shift; | ||
| 10 | |||
| 11 | if( scalar @{$self->fields} != 1 ){ | ||
| 12 | die $self. " can only have one fields attribute" | ||
| 13 | } | ||
| 14 | |||
| 15 | my $filter = { | ||
| 16 | 'type' => $self->type, | ||
| 17 | 'field' => @{$self->fields}[0]->build | ||
| 18 | }; | ||
| 19 | |||
| 20 | return $filter; | ||
| 21 | } | ||
| 22 | |||
| 23 | 1; |