Forum: Ruby on Rails Uso de SPLAT

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
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-...
This topic is locked and can not be replied to.