lib/ruote/workitem.rb in ruote-2.1.10 vs lib/ruote/workitem.rb in ruote-2.1.11

- old
+ new

@@ -142,11 +142,11 @@ fields['__result__'] = r end # When was this workitem dispatched ? # - def dispatch_at + def dispatched_at fields['dispatched_at'] end # Warning : equality is based on fei and not on payload ! @@ -231,9 +231,36 @@ # # => { 'ref' => 'toto', 'task' => 'x' } # def params @h['fields']['params'] + end + + # (advanced) + # + # Shortcut for wi.fields['__command__'] + # + # __command__ is read by the 'cursor' and the 'iterator' expressions + # when a workitem reaches it (apply and reply). + # + def commmand + + @h['fields']['__command__'] + end + + # (advanced) + # + # Shortcut for wi.fields['__command__'] = x + # + # __command__ is read by the 'cursor' and the 'iterator' expressions + # when a workitem reaches it (apply and reply). + # + def command= (com) + + com = com.is_a?(Array) ? com : com.split(' ') + com[1] = com[1].to_i if com[1] + + @h['fields']['__command__'] = com end end end