Guest User

Untitled

a guest
Jun 21st, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1.  
  2. class BaseParticipant
  3. include Ruote::LocalParticipant
  4.  
  5. def initialize(opts)
  6. @opts = []
  7. end
  8.  
  9. def validate(workitem)
  10. (@opts[:present] || []).each { |field_name|
  11. raise ArgumentError.new(
  12. "missing field '#{field_name}'"
  13. ) if workitem.fields[field_name].nil?
  14. }
  15. end
  16.  
  17. def consume(workitem)
  18. validate(workitem)
  19. do_consume(workitem)
  20. end
  21. end
  22.  
  23. class FinalParticipant < BaseParticipant
  24.  
  25. def do_consume(workitem)
  26. # do the work
  27. end
  28. end
Add Comment
Please, Sign In to add comment