Module: Protobuf::Descriptor
- Defined in:
- lib/protobuf/descriptor/descriptor.rb,
lib/protobuf/descriptor/enum_descriptor.rb,
lib/protobuf/descriptor/file_descriptor.rb,
lib/protobuf/descriptor/field_descriptor.rb,
lib/protobuf/descriptor/descriptor_builder.rb
Defined Under Namespace
Classes: Descriptor, DescriptorBuilder, EnumDescriptor, FieldDescriptor, FileDescriptor
Class Method Summary collapse
- .id2label(label_id) ⇒ Object
- .id2type(type_id) ⇒ Object
- .label2id(label) ⇒ Object
- .type2id(type) ⇒ Object
Class Method Details
.id2label(label_id) ⇒ Object
93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/protobuf/descriptor/descriptor_builder.rb', line 93 def self.id2label(label_id) require 'protobuf/descriptor/descriptor_proto' case label_id when Google::Protobuf::FieldDescriptorProto::Label::LABEL_REQUIRED :required when Google::Protobuf::FieldDescriptorProto::Label::LABEL_OPTIONAL :optional when Google::Protobuf::FieldDescriptorProto::Label::LABEL_REPEATED :repeated else raise ArgumentError.new("Invalid label: #{proto.label}") end end |
.id2type(type_id) ⇒ Object
.label2id(label) ⇒ Object
107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/protobuf/descriptor/descriptor_builder.rb', line 107 def self.label2id(label) require 'protobuf/descriptor/descriptor_proto' case label when :required Google::Protobuf::FieldDescriptorProto::Label::LABEL_REQUIRED when :optional Google::Protobuf::FieldDescriptorProto::Label::LABEL_OPTIONAL when :repeated Google::Protobuf::FieldDescriptorProto::Label::LABEL_REPEATED else raise ArgumentError.new("Invalid label: #{label}") end end |