Hello, On this "let's make participant registration better / less obscure", I've just added two methods to Engine :
http://github.com/jmettraux/ruote/commit/7cca2c77a7fceb151f7a3fe787b388425fa804c3 Here is an example usage : ---8<--- engine.register_participant :alpha, MyParticipant, 'message' => 'hello' # interrogate participant list # list = engine.participant_list participant = list.first p participant.regex # => "^alpha$" p participant.classname # => "MyParticipant" p participant.options # => {"message"=>"hello"} # update participant list # participant.regex = '^alfred$' engine.participant_list = list --->8--- The participant list as whole can thus be manipulated (and checked for consistency). I've also revived (added tests for) :require_path and added the :load_path friend : http://github.com/jmettraux/ruote/commit/d00fdd7ebf9e7e65c129d15b9e879d5bd0ee6340 ---8<--- engine.register_participant( :alpha, 'Parts::MyParticipant', 'require_path' => 'parts/my_participant.rb', 'flavour' => 'mango') # # each time the worker has to deliver to this participant, it will # require('parts/my_participant.rb') which will return immediately # if the file is already loaded engine.register_participant( :alpha, 'Parts::MyOtherParticipant', 'load_path' => 'parts/my_other_participant.rb', 'flavour' => 'lychee') # # each time the worker has to deliver to this participant, it will # load('parts/my_other_participant.rb') which will always read and eval # the ruby file (up-to-date implementation will be used) --->8--- I have removed the register_from_dir() for now, I want to re-introduce it at some point (maybe in the form of a participant for better modularity). ---8<--- engine.register_participant( 'auto-.+', Ruote::DirParticipant, :path => 'participants/auto/') --->8--- That could keep the participant-list fat-free and let people creatively extend / take inspiration from Ruote::DirParticipant. The register(&block) idea is still in the works (the port from ruote-kit to ruote). I'm also thinking about letting participant refuse to handle a workitem (which could bring interesting behaviours when iterating the participant list (or maybe this is too complicated...) Cheers, -- John Mettraux - http://jmettraux.wordpress.com -- you received this message because you are subscribed to the "ruote users" group. to post : send email to [email protected] to unsubscribe : send email to [email protected] more options : http://groups.google.com/group/openwferu-users?hl=en
