Ruby on Rails Tuesday, December 17, 2013

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 | LinkedIn: marco-antonio-almeida-filho


On Tue, Dec 17, 2013 at 8:24 PM, Pablo Joaquim <pj.silva.melo@gmail.com> wrote:
Ola, sou novo com ruby e estou tentando aprender mais sobre ele, porem me deparei com um fato estranho.
De acordo com o código a baixo eu vou ter duas saídas, porem não entendo o por que de ter valores diferentes quando uso a syntax sugar em conjunto com splat.
Alguém 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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/3939c4ae-c2aa-4387-8fe2-52044a538835%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACMkcE7yLWEs1qexTh79jgWVivosBQmGJhy-34zZrVFyO5cGtA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment