From: Rick DeNatale Date: 2010-04-16T23:49:38+09:00 Subject: Re: Blocks and local variable creation On Fri, Apr 16, 2010 at 5:21 AM, John Lane wrote: > The reason I was returning nil was so I can the write code like this: > > rights_held = rights_for_item (rights_hash, item) > perform_something_with_rights unless rights_hash.nil? I think you meant rights_held instead of rights_hash in that second line. > perhaps I should change that thought process to this: > > rights_held = rights_for_item (rights_hash, item) > perform_something_with_rights unless rights_hash.empty? My inclination would be to do something like perform_something_with_rights(rights_for_item(rights_hash, item)) Let the thing which needs the rights deal with what rights it has, and an empty collection(array) of rights seems a better representation of empty rights than nil. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitter: @RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale