John Merlino wrote in post #1014812:
> My understanding of the + operator is as follows. The + operator works
> differently with arrays than it does with scalar values. With arrays,
> when
> taking two arrays as operands, it returns an array containing everything
> in
> the two oeprand arrays. In essence, + operator performs addition on
> scalar
> types and union on arrays. For string, it does string concatenation.
Yes, that's all correct. + is just a strange name for a ruby method.
If you write:
"hello" + " world"
That is equivalent to:
"hello".+("world")
That may look confusing but suppose you were calling a method like
split:
"hello,world".split(",")
That is the exact same format as the + method call:
obj.meth_name(arg)
> But
> what it does with blocks of html
>
That's not what the docs mean about the return value of content_tag. In
html, the term 'block tag' has a specific meaning. The docs aren't
describing the return value, which is actually a String. Good docs list
the return type of a method because that is one of the most important
things you can know about a method in addition to the argument types.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.