factor out arg handling
[scpubgit/DKit.git] / lib / DX / Op / CallRule.pm
index f97d187..2cd8c74 100644 (file)
@@ -17,19 +17,7 @@ has full_name => (is => 'lazy', builder => sub {
 
 sub run {
   my ($self, $state) = @_;
-  my @args = map {
-    if (!ref($_)) {
-      $state->scope_var($_)
-    } elsif (ref($_) eq 'ARRAY') {
-      if ($_->[0] eq 'value') {
-        +{ bound_value => $_->[1] };
-      } else {
-        die "Arrayref in argspec is not value";
-      }
-    } else {
-      die "Argspec incomprehensible";
-    }
-  } @{$self->rule_args};
+  my @args = map $self->_expand_argspec($state, $_), @{$self->rule_args};
   my @rules = @{$state->rule_set->rules->{$self->full_name}||[]};
   die "No rules for ${\$self->full_name}" unless @rules;
   my $var = DX::Var->new(id => 'OR')