Class: Protobuf::Descriptor::FileDescriptor
- Inherits:
-
Object
- Object
- Protobuf::Descriptor::FileDescriptor
- Defined in:
- lib/protobuf/descriptor/file_descriptor.rb
Class Method Summary collapse
Class Method Details
.build(proto, opt = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/protobuf/descriptor/file_descriptor.rb', line 9 def build(proto, opt={}) mod = Object if package = proto.package and not package.empty? module_names = package.split '::' module_names.each do |module_name| mod = mod.const_set module_name, Module.new end end proto..each do || Protobuf::Message.descriptor.build , :module => mod end proto.enum_type.each do |enum_proto| Protobuf::Enum.descriptor.build enum_proto, :module => mod end end |
.proto_type ⇒ Object
5 6 7 |
# File 'lib/protobuf/descriptor/file_descriptor.rb', line 5 def proto_type 'Google::Protobuf::FileDescriptorProto' end |
.unbuild(messages) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/protobuf/descriptor/file_descriptor.rb', line 25 def unbuild() = [] unless .is_a? Array proto = Google::Protobuf::FileDescriptorProto.new proto.package = .first.to_s.split('::')[0..-2].join('::') if .first.to_s =~ /::/ .each do || .descriptor.unbuild proto end proto end |