John, amazing work - I can't wait to apply this to my project tomorrow.
I love the two layers of extensibility - the service and the context, so
you can easily make (enhance) the DSL for your expressions or completely
swap everything out if you need something heavy duty. I'm on the fence
about returning nil when method missing is encountered. On the one hand,
trapping errors if a nil is possible would be a big pain, on the other,
if nils aren't generally possible, then an exception is much more
explicit. I think what you have is fine, or someday you could have a
flag like 'strict' or something as a static method of the service or
context if it ever became a problem for people. 

Whatever the case, there is now nothing left in ruote that will prevent
us from making it fit our solution like a glove, so I'm very
appreciative of your work. 

We'll be contributing a MongoDB storage service in the near future, so
we'll be sure to post a link when we do. What is your process when you
do a new storage back end? Do you have a common test suite you run to
verify the new storage mechanism, or do you write fresh tests for each
one?

Thanks again. This may be the most responsive open source project I've
encountered so far :)

Nathan 


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of John Mettraux
Sent: Sunday, September 05, 2010 5:50 PM
To: [email protected]
Subject: Re: [ruote:2588] Boolean operators and filters/conditions in
Ruote


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/9376e80f92bb1471f4540799a7cdf02
83aa9099d

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/6ddc16d233211dd02f1c8aa79edbe64
cecb7af61

The last step was to allow for ${r:name_of_field} from the ruby context
:

 
http://github.com/jmettraux/ruote/commit/6968d9aad58f5d6694617ee508cb679
ec88e54b5

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

-- 
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

Reply via email to