The latest versions on master fixes the #select issue. Thanks!
-- Simone 2011/6/24 John Mettraux <[email protected]> > > On Thu, Jun 23, 2011 at 06:10:17PM +0200, Simone Carletti wrote: > > > > I'm experimenting with the development version of Ruote (primary because > I'd > > love to give you a feedback about the new "temporary fields feature") and > I > > just noticed a compatibility break with Ruote 2.2.0. > > > > This is the diff. > > https://github.com/jmettraux/ruote/compare/v2.2.0...master#diff-39 > > > > I have the following piece of code > > > > class MyClass > > def by_user(user) > > list = $engine.storage_participant.select do |workitem| > > workitem.target_includes?(user) > > end > > list.map { |w| new(w) } > > end > > end > > > > It worked with Ruote 2.2.0 but now it raises the error > > > > NoMethodError: > > protected method `select' called for > > #<Ruote::StorageParticipant:0x105251da8> > > > > because you defined a new #select method on the StorageParticipant class. > > This method overrides the default enumerable#select method and it also > > changes the method API. > > Is it intentional? > > Hello Simone, > > excellent ! > > No this is not intentional. You are right, preserving the benefits of > Enumerable is a must. > > > https://github.com/jmettraux/ruote/commit/ff0eeb01c0cbca0e04e3b309d9b15750a933c1d5 > > If the issue is not completely fixed by the commit, please tell me. > > > Also, I noticed you changed the fetch_all API and the parameter is no > longer > > optional. It doesn't really affect my code but I believe this change make > > some methods incoherent with others, like for example the #all(opt = {}) > > method. > > https://github.com/jmettraux/ruote/compare/v2.2.0...master#L39L156 > > OK, #fetch_all(opts) is a protected method, other, public, methods are > using it and they can deal with that non-optional opts thing. > > Most of the methods using fetch_all are test covered (unlike the Enumerable > provided #select) and there were no issues so far. > > I did a check run for fetch_all in the ruote codebase : > > ---8<--- > jmettraux@sanma ~/w/ruote (master) 円 ak fetch_all lib/ > > lib/ruote/part/storage_participant.rb > 160: fetch_all(:count => true) > 174: res = fetch_all(opts) > 184: wi(fetch_all({}).first) > 274: @context.storage.get_many('workitems', wfid, opts) : > fetch_all(opts) > 289: fetch_all({}).each { |hwi| @context.storage.delete(hwi) } > 338: def fetch_all(opts) > 355: hwis = fetch_all({}) > jmettraux@sanma ~/w/ruote (master) 円 ak fetch_all ../ruote-beanstalk/lib/ > jmettraux@sanma ~/w/ruote (master) 円 ak fetch_all ../ruote-redis/lib/ > jmettraux@sanma ~/w/ruote (master) 円 ak fetch_all ../ruote-dm/lib/ > jmettraux@sanma ~/w/ruote (master) 円 ak fetch_all ../ruote-sequel/lib/ > jmettraux@sanma ~/w/ruote (master) 円 ak fetch_all ../ruote-couch/lib/ > jmettraux@sanma ~/w/ruote (master) 円 > --->8--- > > there is no #fetch_all call without an hash argument. > > It's OK for users of the public methods to drop the optional "opts", while > I force myself (as author of StorageParticipant) to provide a "opts" Hash > when calling #fetch_all. > > > Thanks again ! > > -- > 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 -- Simone Carletti Application Developer Site & Blog: http://www.simonecarletti.com Email: [email protected] LinkedIn: http://linkedin.com/in/weppos Skype: weppos -- 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
