Class: ProtobufDescriptor::EnumDescriptor

Inherits:
Object
  • Object
show all
Includes:
HasChildren, HasParent, NamedChild
Defined in:
lib/protobuf_descriptor/enum_descriptor.rb

Overview

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HasChildren

#compute_source_code_info_path_component, included, #named_children

Methods included from NamedChild

#fully_qualified_java_name, #fully_qualified_name, #fully_qualified_ruby_name, #fully_qualified_wire_name, #inspect

Methods included from HasParent

#compute_source_code_info_path, #file_descriptor, #leading_comments, #protobuf_descriptor, #source_code_info_location, #source_code_info_locations, #source_code_info_span, #trailing_comments

Constructor Details

#initialize(parent, enum_descriptor_proto) ⇒ EnumDescriptor

Returns a new instance of EnumDescriptor.



24
25
26
27
28
29
30
31
32
# File 'lib/protobuf_descriptor/enum_descriptor.rb', line 24

def initialize(parent, enum_descriptor_proto)
  @parent = parent
  @enum_descriptor_proto = enum_descriptor_proto

  @value = ProtobufDescriptor::NamedCollection.new(
      enum_descriptor_proto.value.map { |m|
        ProtobufDescriptor::EnumValueDescriptor.new(self, m)
      })
end

Instance Attribute Details

#enum_descriptor_protoObject (readonly)

The +EnumDescriptorProto+ this +EnumDescriptor+ is wrapping.



15
16
17
# File 'lib/protobuf_descriptor/enum_descriptor.rb', line 15

def enum_descriptor_proto
  @enum_descriptor_proto
end

#parentObject (readonly)

The containing FileDescriptor or MessageDescriptor that defines this enum.



12
13
14
# File 'lib/protobuf_descriptor/enum_descriptor.rb', line 12

def parent
  @parent
end

#valueObject (readonly) Also known as: values

List of the enum values for this EnumDescriptor as a NamedCollection of ProtobufDescriptor::EnumValueDescriptor



19
20
21
# File 'lib/protobuf_descriptor/enum_descriptor.rb', line 19

def value
  @value
end

Instance Method Details

#nameObject

The name of the enum



35
# File 'lib/protobuf_descriptor/enum_descriptor.rb', line 35

def name; enum_descriptor_proto.name; end

#optionsObject

The +EnumOptions+ defined for this enum



38
# File 'lib/protobuf_descriptor/enum_descriptor.rb', line 38

def options; enum_descriptor_proto.options; end