From: Brian Candler Date: 2009-08-20T21:03:45+09:00 Subject: Re: #has_arguments? Robert Klemme wrote: > As a side note: I see this sometimes > > def m(a = nil) > @a = a.nil? ? 123 : a > end > > which is of course silly. The same would be much better expressed as > > def m(a = 123) > @a = a > end No, it's not the same. Consider: def foo(a = nil) m(a) end foo() It saves replicating your default values all over the place, which isn't very DRY. Or you could more simply write def m(a = nil) @a = a || 123 end -- Posted via http://www.ruby-forum.com/.