Ruby 文档中的 "ios" 是什么?

What is "ios" in the Ruby documentation for puts?

iOS 弄乱了这个问题的良好搜索结果。 The Ruby docs for puts 说它

writes the given object(s) to ios.

什么是"ios"。我最好的猜测是 "input/output stream" 但不确定这是否有意义。

你猜对了。这是使用术语 iosI/O streams 的段落:https://ruby-doc.org/core-2.5.0/IO.html#method-i-close 希望对您有所帮助。

无论您在 puts 上调用什么:

$stderr.puts("Hello from Standard Error") # $stderr is IO
puts("Hello from Kernel") # main is IO
File.new("/tmp/foo").puts("bar") # File is IO

继承自 IO(或 Kernel)的任何内容都将响应 puts

$stderr.class.ancestors # => [IO, File::Constants, Enumerable, Object, Kernel, BasicObject]
self.class.ancestors # => [Object, Kernel, BasicObject]
File.ancestors # => [File, IO, File::Constants, Enumerable, Object, Kernel, BasicObject]