Class: Google::Protobuf::RepeatedField::ProxyingEnumerator

Inherits:
Struct
  • Object
show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/google-protobuf-3.21.12-x86_64-linux/lib/google/protobuf/repeated_field.rb

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#external_enumeratorObject

Returns the value of attribute external_enumerator

Returns:

  • (Object)

    the current value of external_enumerator



183
184
185
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/google-protobuf-3.21.12-x86_64-linux/lib/google/protobuf/repeated_field.rb', line 183

def external_enumerator
  @external_enumerator
end

#repeated_fieldObject

Returns the value of attribute repeated_field

Returns:

  • (Object)

    the current value of repeated_field



183
184
185
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/google-protobuf-3.21.12-x86_64-linux/lib/google/protobuf/repeated_field.rb', line 183

def repeated_field
  @repeated_field
end

Instance Method Details

#each(*args, &block) ⇒ Object



184
185
186
187
188
189
190
191
192
193
194
195
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/google-protobuf-3.21.12-x86_64-linux/lib/google/protobuf/repeated_field.rb', line 184

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