if (ref($v) eq 'ARRAY') {
return $self->_expand_expr($v, $logic);
}
+ die "notreached";
}
{
my $op = $k;
return { -op => [ $op, $v ] };
}
}
- if (my $custom = $self->{expand_unary}{$k}) {
- return $self->$custom($v);
- }
if ($self->{render}{$k}) {
return { $k => $v };
}
puke "ordering direction hash passed to order by must have exactly one key (-asc or -desc)";
}
}
- my @exp = map +(defined($dir) ? { -op => [ $dir => $_ ] } : $_),
+ my @exp = map +(
+ defined($dir) ? { -op => [ $dir =~ /^-?(.*)$/ ,=> $_ ] } : $_
+ ),
map $self->expand_expr($_, -ident),
map ref($_) eq 'ARRAY' ? @$_ : $_, @to_expand;
return (@exp > 1 ? { -list => \@exp } : $exp[0]);
};
- local @{$self->{expand_unary}}{qw(-asc -desc)} = (
- sub { shift->$expander(asc => @_) },
- sub { shift->$expander(desc => @_) },
- );
+ local @{$self->{expand}}{qw(-asc -desc)} = (($expander) x 2);
return $self->$expander(undef, $arg);
}