The +
operator is the normal concatenation choice, and is probably the fastest way to concatenate strings.
The difference between +
and <<
is that <<
changes the object on its left hand side, and +
doesn't.
irb(main):001:0> s = 'a'
=> "a"
irb(main):002:0> s + 'b'
=> "ab"
irb(main):003:0> s
=> "a"
irb(main):004:0> s << 'b'
=> "ab"
irb(main):005:0> s
=> "ab"