class Google::Protobuf::MethodDescriptor

Attributes

method_def[RW]

Public Class Methods

from_native(method_def, _ = nil) click to toggle source

@param service_def [::FFI::Pointer] MethodDef pointer to be wrapped @param _ [Object] Unused

# File lib/google/protobuf/ffi/method_descriptor.rb, line 35
def from_native(method_def, _ = nil)
  return nil if method_def.nil? or method_def.null?
  service_def = Google::Protobuf::FFI.raw_service_def_by_raw_method_def(method_def)
  file_def = Google::Protobuf::FFI.file_def_by_raw_service_def(service_def)
  descriptor_from_file_def(file_def, method_def)
end
new(*arguments, &block) click to toggle source
# File lib/google/protobuf/ffi/method_descriptor.rb, line 43
def self.new(*arguments, &block)
  raise "Descriptor objects may not be created from Ruby."
end
new(method_def, descriptor_pool) click to toggle source
# File lib/google/protobuf/ffi/method_descriptor.rb, line 86
def initialize(method_def, descriptor_pool)
  @method_def = method_def
  @descriptor_pool = descriptor_pool
end
to_native(value, _) click to toggle source

@param value [MethodDescriptor] MethodDescriptor to convert to an FFI native type @param _ [Object] Unused

# File lib/google/protobuf/ffi/method_descriptor.rb, line 25
def to_native(value, _)
  method_def_ptr = value.nil? ? nil : value.instance_variable_get(:@method_def)
  return ::FFI::Pointer::NULL if method_def_ptr.nil?
  raise "Underlying method_def was null!" if method_def_ptr.null?
  method_def_ptr
end

Private Class Methods

private_constructor(method_def, descriptor_pool) click to toggle source
# File lib/google/protobuf/ffi/method_descriptor.rb, line 91
def self.private_constructor(method_def, descriptor_pool)
  instance = allocate
  instance.send(:initialize, method_def, descriptor_pool)
  instance
end

Public Instance Methods

client_streaming() click to toggle source
# File lib/google/protobuf/ffi/method_descriptor.rb, line 76
def client_streaming
  @client_streaming ||= Google::Protobuf::FFI.method_client_streaming(self)
end
input_type() click to toggle source
# File lib/google/protobuf/ffi/method_descriptor.rb, line 68
def input_type
  @input_type ||= Google::Protobuf::FFI.method_input_type(self)
end
inspect() click to toggle source
# File lib/google/protobuf/ffi/method_descriptor.rb, line 51
def inspect
  "#{self.class.name}: #{name}"
end
name() click to toggle source
# File lib/google/protobuf/ffi/method_descriptor.rb, line 55
def name
  @name ||= Google::Protobuf::FFI.get_method_name(self)
end
options() click to toggle source
# File lib/google/protobuf/ffi/method_descriptor.rb, line 59
def options
  @options ||= begin
    size_ptr = ::FFI::MemoryPointer.new(:size_t, 1)
    temporary_arena = Google::Protobuf::FFI.create_arena
    buffer = Google::Protobuf::FFI.method_options(self, size_ptr, temporary_arena)
    Google::Protobuf::MethodOptions.decode(buffer.read_string_length(size_ptr.read(:size_t)).force_encoding("ASCII-8BIT").freeze).freeze
  end
end
output_type() click to toggle source
# File lib/google/protobuf/ffi/method_descriptor.rb, line 72
def output_type
  @output_type ||= Google::Protobuf::FFI.method_output_type(self)
end
server_streaming() click to toggle source
# File lib/google/protobuf/ffi/method_descriptor.rb, line 80
def server_streaming
  @server_streaming ||= Google::Protobuf::FFI.method_server_streaming(self)
end
to_s() click to toggle source
# File lib/google/protobuf/ffi/method_descriptor.rb, line 47
def to_s
  inspect
end

Private Instance Methods

c_type() click to toggle source
# File lib/google/protobuf/ffi/method_descriptor.rb, line 97
def c_type
  @c_type ||= Google::Protobuf::FFI.get_c_type(self)
end