From: Brian Candler Date: 2010-09-16T22:10:39+09:00 Subject: Re: def swfupload_file=(data) Abder-Rahman Ali wrote: > Following this tutorial: > http://jimneath.org/2008/05/15/swfupload-paperclip-and-ruby-on-rails/ > > I want to ask about this method definition: > > def swfupload_file=(data) > > What is meant by the =(data) part? The method's name is "swfupload_file=", and (data) is the one argument that the method takes. Methods with name ending '=' are treated slightly specially. The syntax foo.bar = baz looks like an assignment, but it isn't. It is actually calling method "bar=" on object foo, with argument baz. In long-hand it would be foo.send(:bar=, baz) Also, these sorts of methods always return their argument, not the final value evaluated or the value on a 'return' statement. That is, a = foo.bar = baz will always set a to baz, regardless of what the method bar= returns. -- Posted via http://www.ruby-forum.com/.