class Google::Protobuf::Internal::OneofBuilder

Public Class Methods

new(name, msg_builder) click to toggle source
# File lib/google/protobuf/descriptor_dsl.rb, line 420
def initialize(name, msg_builder)
  @msg_builder = msg_builder
  oneof_proto = Google::Protobuf::OneofDescriptorProto.new(
    :name => name
  )
  msg_proto = msg_builder.internal_msg_proto
  @oneof_index = msg_proto.oneof_decl.size
  msg_proto.oneof_decl << oneof_proto
end

Public Instance Methods

optional(name, type, number, type_class=nil, options=nil) click to toggle source
# File lib/google/protobuf/descriptor_dsl.rb, line 430
def optional(name, type, number, type_class=nil, options=nil)
  @msg_builder.internal_add_field(
      :LABEL_OPTIONAL, name, type, number, type_class, options,
      oneof_index: @oneof_index)
end