In Ruby repeated fields, each_index actually iterates over the index (#11767)
Currently we're aliasing `each_index` to `each_with_index`, incorrectly passing both the index and the value of a repeated field to the block.
What we want is to just pass the index. Luckily this is a method on Ruby arrays, so we just wrap the native Ruby array method.
Fixes https://github.com/protocolbuffers/protobuf/issues/7806
Closes #11767
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/11767 from shaldengeki:shaldengeki-repeated-field-each-index-returns-actual-index 874916c21d
PiperOrigin-RevId: 593835025
pull/15190/head
parent
da56def7c2
commit
f869cfa479
3 changed files with 29 additions and 2 deletions
Loading…
Reference in new issue