Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

IO#<<

ios << obj → ios

String Output—Writes obj to ios. obj will be converted to a string using to_s.

Example
$stdout << "Hello " << "world!\n"

produces:

Example
Hello world!
See also .write #advise .try_convert #autoclose= also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1