I found this inside a method I want to override in the formtastic Gem. The method looks like:
def to_html
input_wrapping do
hidden_field_html <<
label_with_nested_checkbox
end
end
What does the <<
do on the third line? I know what it does with Arrays but here I have no idea.
You can read it like this:
hidden_field_html << label_with_nested_checkbox
label_with_nested_checkbox
is the argument being concatenated onto the end of hidden_field_html
- they've split it over two lines for 'clarity'