class Google::Protobuf::FileDescriptor
Attributes
Public Class Methods
Source
# File lib/google/protobuf/ffi/file_descriptor.rb, line 21 def initialize(file_def, descriptor_pool) @descriptor_pool = descriptor_pool @file_def = file_def end
Public Instance Methods
Source
# File lib/google/protobuf/ffi/file_descriptor.rb, line 30 def inspect "#{self.class.name}: #{name}" end
Source
# File lib/google/protobuf/ffi/file_descriptor.rb, line 34 def name Google::Protobuf::FFI.file_def_name(@file_def) end
Source
# File lib/google/protobuf/ffi/file_descriptor.rb, line 38 def options @options ||= begin size_ptr = ::FFI::MemoryPointer.new(:size_t, 1) temporary_arena = Google::Protobuf::FFI.create_arena buffer = Google::Protobuf::FFI.file_options(@file_def, size_ptr, temporary_arena) opts = Google::Protobuf::FileOptions.decode(buffer.read_string_length(size_ptr.read(:size_t)).force_encoding("ASCII-8BIT").freeze) opts.clear_features() opts.freeze end end
Source
# File lib/google/protobuf/ffi/file_descriptor.rb, line 49 def to_proto @to_proto ||= begin size_ptr = ::FFI::MemoryPointer.new(:size_t, 1) temporary_arena = Google::Protobuf::FFI.create_arena buffer = Google::Protobuf::FFI.file_to_proto(@file_def, size_ptr, temporary_arena) Google::Protobuf::FileDescriptorProto.decode(buffer.read_string_length(size_ptr.read(:size_t)).force_encoding("ASCII-8BIT").freeze) end end