Re: [Rails] An idea for new syntactic sugar in Ruby

2011-05-20 Thread David Kahn
On Fri, May 20, 2011 at 4:23 PM, Rob Biedenharn wrote: > On May 20, 2011, at 5:05 PM, Curtis j Schofield wrote: > > if notice = response_status_and_flash.delete(:notice) >>flash[:notice] = notice >> end >> >> > This is a common C idiom. > > The best solution is to always write your == with t

Re: [Rails] An idea for new syntactic sugar in Ruby

2011-05-20 Thread Rob Biedenharn
On May 20, 2011, at 5:05 PM, Curtis j Schofield wrote: if notice = response_status_and_flash.delete(:notice) flash[:notice] = notice end This is a common C idiom. The best solution is to always write your == with the constant on the LEFT instead of the right. :D -- make haste slowly \

Re: [Rails] An idea for new syntactic sugar in Ruby

2011-05-20 Thread Curtis j Schofield
> > if notice = response_status_and_flash.delete(:notice) >flash[:notice] = notice > end > > This is a common C idiom. The best solution is to always write your == with the constant on the LEFT instead of the right. :D -- make haste slowly \ festina lente \ - mobile +1_415_632_6001 cu

Re: [Rails] An idea for new syntactic sugar in Ruby

2011-02-15 Thread Colin Law
On 15 February 2011 01:18, Kai Middleton wrote: > I was looking at this bit of code within Rails: > > # File actionpack/lib/action_controller/metal/flash.rb, line 12 > def redirect_to(options = {}, response_status_and_flash = {}) #:doc: >  if alert = response_status_and_flash.delete(:alert) >    f

Re: [Rails] An idea for new syntactic sugar in Ruby

2011-02-14 Thread Philip Hallstrom
> I was looking at this bit of code within Rails: > > # File actionpack/lib/action_controller/metal/flash.rb, line 12 > def redirect_to(options = {}, response_status_and_flash = {}) #:doc: > if alert = response_status_and_flash.delete(:alert) >flash[:alert] = alert > end > > if notice = re

[Rails] An idea for new syntactic sugar in Ruby

2011-02-14 Thread Kai Middleton
I was looking at this bit of code within Rails: # File actionpack/lib/action_controller/metal/flash.rb, line 12 def redirect_to(options = {}, response_status_and_flash = {}) #:doc: if alert = response_status_and_flash.delete(:alert) flash[:alert] = alert end if notice = response_status_