-----Messaggio originale-----
Da: Junayeed Ahnaf Nirjhor [mailto:zombiegenerator / aol.com] 
Inviato: luned14 novembre 2011 12:52
A: ruby-talk ML
Oggetto: Noob question regarding custom method

Hello,

I am still learning ruby. My question is, often we see things like this:

   def set_miles(miles)
     @miles = miles
   end

Here, we're defining a custom method set_miles , then passing it an argument
(what's the reason of doing so?), then we're setting the instance variable
@miles to a local variable miles, why's that for? I know I can use
attr_accessor but things like this occurs in various place. What's the point
of doing this?


I know I sound funny but i can't understand. Any help would be much much
much appreciated.
--
Junayeed Ahnaf Nirjhor
/Doing this and that/
http://twitter.com/nirjhor

 
 
 --
 Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP autenticato? GRATIS solo con Email.it http://www.email.it/f
 
 Sponsor:
 Capodanno a Riccione, Pacchetto Relax: Mezza Pensione + bagno turco + solarium + massaggio. Wifi e parcheggio gratis. 2 giorni euro 199 a persona
 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid979&d)-12