Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是 Ruby 新手,我不懂 ruby 文档。我剪了一段 ruby 文档。请完全解释这件作品。谢谢
这些是方法的签名File#open。由于 Ruby 不支持方法重载,因此只有一种这样的方法,但接受不同的参数组合(并可能返回不同的东西)。
File#open
为了澄清语法,屏幕截图中的第一种形式:
open(filename, mode='r'[, opt]) -> file
意味着第一种形式的File#open方法需要以下参数:
'r'
并且它返回一个文件对象。