gpt4 book ai didi

ruby - 比 ruby 少一倍

转载 作者:数据小太阳 更新时间:2023-10-29 07:23:57 26 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
Interested in what the “<<” does

我读了Ruby class inheritance: What is `<<` (double less than)? .我知道它有助于为实例创建方法(一种继承)。但是我遇到了一个代码:

threads << Thread.new(page) { |myPage|
h = Net::HTTP.new(myPage, 80)
puts "Fetching: #{myPage}"
resp, data = h.get('/', nil )
puts "Got #{myPage}: #{resp.message}"
}

哪里threads是一个数组。有人可以解释一下 << 的用法吗?用对象而不是类?

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com