Class: Google::Protobuf::Internal::EnumBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/google/protobuf/descriptor_dsl.rb

Instance Method Summary collapse

Constructor Details

#initialize(name, file_proto) ⇒ EnumBuilder

Returns a new instance of EnumBuilder.



438
439
440
441
442
443
# File 'lib/google/protobuf/descriptor_dsl.rb', line 438

def initialize(name, file_proto)
  @enum_proto = Google::Protobuf::EnumDescriptorProto.new(
    :name => name
  )
  file_proto.enum_type << @enum_proto
end

Instance Method Details

#value(name, number) ⇒ Object



445
446
447
448
449
450
451
# File 'lib/google/protobuf/descriptor_dsl.rb', line 445

def value(name, number)
  enum_value_proto = Google::Protobuf::EnumValueDescriptorProto.new(
    name: name,
    number: number
  )
  @enum_proto.value << enum_value_proto
end