Like puts
(which sounds similar), it is designed to work with lines, using the
character.
gets
takes an optional argument that is used for "splitting" the input (or "just reading till it arrives). It defaults to the special global variable $/
, which contains a
by default.
gets
is a pretty generic method for readings streams and includes this separator. If it would not do it, parts of the stream content would be lost.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…