Forum: Ruby on Rails Uso de SPLAT

0b0c0624cca1ce72c53aab27e675c5f0?d=identicon&s=25 Pablo Joaquim (Guest)
on 2013-12-17 20:31
(Received via mailing list)
Ola, sou novo com ruby e estou tentando aprender mais sobre ele, porem
me
deparei com um fato estranho.
De acordo com o cdigo a baixo eu vou ter duas sadas, porem no entendo o
por que de ter valores diferentes quando uso a syntax sugar em conjunto
com
splat.
Algum pode me responder isso?

class teste

  def faz=(*lista)
     puts lista.size
  end

  def fast(*lista)
     puts lista.size
  end

end

var = teste.new
var.faz="a", "b", "c"
=>1

var.fast"a", "b", "c"
=>3
46a0becb1faafdd991788635ffad0550?d=identicon&s=25 Marco Antonio Almeida (Guest)
on 2013-12-17 23:59
(Received via mailing list)
Hi Pablo,

This is an international list, so if you want your answer you should
write
your question in English.

For this one I will answer your question in private.


*Marco Antonio Almeida*+45 31 65 28 84
Twitter: @marcoafilho <http://www.twitter.com/marcoafilho> | LinkedIn:
marco-antonio-almeida-filho<http://www.linkedin.com/pub/marco-antonio-almeida-...
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.