gpt4 book ai didi

Ruby each.with_index(1) 返回错误 : no block given (yield)

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

尝试迭代表行,跳过第一行。使用 Ruby、Cucumber 和页面对象 gem。

PAGE_CLASS

  table(:table_data, id: 'list')

步骤定义

@current_page.table_data_element.each.with_index(1) do |row|
puts row.value
end

收到错误消息:LocalJumpError: no block given (yield)

最佳答案

试试这个

array.drop(1).each do |row|
...
end

这是如何工作的?

  • drop 跳过 n 个元素,这不会修改原始数组
  • each 枚举所有剩余元素

关于Ruby each.with_index(1) 返回错误 : no block given (yield),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41496640/

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