Class: ProtoPlugin::EnumDescriptor
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- ProtoPlugin::EnumDescriptor
- Defined in:
- lib/proto_plugin/enum_descriptor.rb
Overview
A wrapper class around Google::Protobuf::EnumDescriptorProto
which provides helpers and more idiomatic Ruby access patterns.
Any method not defined directly is delegated to the descriptor the wrapper was initialized with.
Instance Attribute Summary collapse
- #descriptor ⇒ Google::Protobuf::EnumDescriptorProto readonly
-
#parent ⇒ FileDescriptor, MessageDescriptor
readonly
The file or message descriptor this enum was defined within.
Instance Method Summary collapse
-
#full_name ⇒ String
The full name of the enum, including parent namespace.
-
#initialize(descriptor, parent) ⇒ EnumDescriptor
constructor
A new instance of EnumDescriptor.
Constructor Details
#initialize(descriptor, parent) ⇒ EnumDescriptor
Returns a new instance of EnumDescriptor.
25 26 27 28 29 |
# File 'lib/proto_plugin/enum_descriptor.rb', line 25 def initialize(descriptor, parent) super(descriptor) @descriptor = descriptor @parent = parent end |
Instance Attribute Details
#descriptor ⇒ Google::Protobuf::EnumDescriptorProto (readonly)
14 15 16 |
# File 'lib/proto_plugin/enum_descriptor.rb', line 14 def descriptor @descriptor end |
#parent ⇒ FileDescriptor, MessageDescriptor (readonly)
The file or message descriptor this enum was defined within.
20 21 22 |
# File 'lib/proto_plugin/enum_descriptor.rb', line 20 def parent @parent end |
Instance Method Details
#full_name ⇒ String
The full name of the enum, including parent namespace.
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/proto_plugin/enum_descriptor.rb', line 37 def full_name @full_name ||= begin prefix = case parent when MessageDescriptor parent.full_name when FileDescriptor parent.namespace end "#{prefix}::#{name}" end end |