返回顶部

收藏

write strings to the stream (buffer) with the << method, then flush the buffer with flush.

更多
ios = IO.new( 1, 'w' )

ios.puts 'IO, IO, it's off to the computer lab I go.'

ios << 'Ask not ' << 'for whom the bells toll.' << ' -John Donne'

ios.flush # => Ask not for whom the bells toll. -John Donne

标签:Ruby,文件

收藏

0人收藏

支持

0

反对

0

发表评论