On Fri, Sep 03, 2010 at 08:31:00PM -0700, Nathan Stults wrote: > > Awesome! Can't wait to see what you come up with. > > Thanks again for the great project.
Hello Nathan, thanks for the feedback and the advice, it helps make the project better. Here are the changes I made; at first, I made a service out of the substitution code : http://github.com/jmettraux/ruote/commit/9376e80f92bb1471f4540799a7cdf0283aa9099d Then, I made sure the dictionary used for substitution and the ruby context in case of ${r:...} were available for exchange / monkey patching : http://github.com/jmettraux/ruote/commit/6ddc16d233211dd02f1c8aa79edbe64cecb7af61 The last step was to allow for ${r:name_of_field} from the ruby context : http://github.com/jmettraux/ruote/commit/6968d9aad58f5d6694617ee508cb679ec88e54b5 You can thus now write things like participant 'sales_manager', :if => '${r: amount > 10_000 }' Loose methods are mapped to workitem fields. Now there is an issue, should a missing field/method result in a NoMethodError triggering a process error or should the method missing simply return nil ? ${r: (amount || 0) > 10_000 } looks OK. What do you think ? Now back to extensibility : it's now easy to add methods visible to the ruby context by doing things like class Ruote::Dollar::RubyContext def amount @workitem.fields['articles'].inject(0) { |i, a| i + a['count'] * a['price'] } end end All the work happens in : http://github.com/jmettraux/ruote/blob/ruote2.1/lib/ruote/svc/dollar_sub.rb Tell me if you have any question about other extensibility means. 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
