Ruby on Rails
Tuesday, December 17, 2013
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.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment