class Google::Protobuf::RepeatedField::ProxyingEnumerator

propagates changes made by user of enumerator back to the original repeated field. This only applies in cases where the calling function which created the enumerator, such as sort!, modifies itself rather than a new array, such as sort

Public Instance Methods

each(*args) { |val| ... } click to toggle source
# File lib/google/protobuf/repeated_field.rb, line 171
def each(*args, &block)
  results = []
  external_enumerator.each_with_index do |val, i|
    result = yield(val)
    results << result
    #nil means no change occurred from yield; usually occurs when #to_a is called
    if result
      repeated_field[i] = result if result != val
    end
  end
  results
end