Class: ProtobufDescriptor::EnumDescriptor
- Inherits:
-
Object
- Object
- ProtobufDescriptor::EnumDescriptor
- Includes:
- HasChildren, HasParent, NamedChild
- Defined in:
- lib/protobuf_descriptor/enum_descriptor.rb
Overview
Describes an enum type.
See +EnumDescriptorProto+[https://code.google.com/p/protobuf/source/browse/trunk/src/google/protobuf/descriptor.proto#171]
Instance Attribute Summary collapse
-
#enum_descriptor_proto ⇒ Object
readonly
The +EnumDescriptorProto+ this +EnumDescriptor+ is wrapping.
-
#parent ⇒ Object
readonly
The containing FileDescriptor or MessageDescriptor that defines this enum.
-
#value ⇒ Object
(also: #values)
readonly
List of the enum values for this
EnumDescriptor
as aNamedCollection
of EnumValueDescriptor.
Instance Method Summary collapse
-
#initialize(parent, enum_descriptor_proto) ⇒ EnumDescriptor
constructor
A new instance of EnumDescriptor.
-
#name ⇒ Object
The name of the enum.
-
#options ⇒ Object
The +EnumOptions+ defined for this enum.
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_proto ⇒ Object (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 |
#parent ⇒ Object (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 |
#value ⇒ Object (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
#name ⇒ Object
The name of the enum
35 |
# File 'lib/protobuf_descriptor/enum_descriptor.rb', line 35 def name; enum_descriptor_proto.name; end |
#options ⇒ Object
The +EnumOptions+ defined for this enum
38 |
# File 'lib/protobuf_descriptor/enum_descriptor.rb', line 38 def ; enum_descriptor_proto.; end |