# Def swfupload\_file=(data)

**URL:** <https://www.ruby-forum.com/t/def-swfupload-file-data/195079>\
**Category:** Ruby\
**Created:** [September 16, 2010, 3:02pm UTC](https://www.ruby-forum.com/t/def-swfupload-file-data/195079 "2010-09-16T15:02:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![swengineer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/97f17d/32.png) [@swengineer](https://www.ruby-forum.com/u/swengineer)\
**Post date:** [September 16, 2010, 3:02pm UTC](https://www.ruby-forum.com/t/def-swfupload-file-data/195079/1 "2010-09-16T15:02:11Z")

</div>

Following this tutorial:  
[http://jimneath.org/2008/05/15/swfupload-paperclip-and-ruby-on-rails/](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?

Thanks.

---

<div class="post-metadata">

**Author:** ![swengineer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/97f17d/32.png) [@swengineer](https://www.ruby-forum.com/u/swengineer)\
**Post date:** [September 16, 2010, 3:09pm UTC](https://www.ruby-forum.com/t/def-swfupload-file-data/195079/2 "2010-09-16T15:09:20Z")

</div>

Abder-Rahman A. wrote:

> Following this tutorial:  
> [http://jimneath.org/2008/05/15/swfupload-paperclip-and-ruby-on-rails/](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.

---

<div class="post-metadata">

**Author:** ![swengineer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/97f17d/32.png) [@swengineer](https://www.ruby-forum.com/u/swengineer)\
**Post date:** [September 16, 2010, 3:13pm UTC](https://www.ruby-forum.com/t/def-swfupload-file-data/195079/3 "2010-09-16T15:13:41Z")

</div>

Thanks Brian for your clarification.
