Class: Gruf::Controllers::ServiceBinder

Inherits:
Object
  • Object
show all
Defined in:
lib/gruf/controllers/service_binder.rb

Overview

Binds gRPC services to a gruf controller

Defined Under Namespace

Classes: BoundDesc

Instance Method Summary collapse

Constructor Details

#initialize(service) ⇒ ServiceBinder

Initialize a service binder instance with the given service

Parameters:

  • service (GRPC::GenericService)

    The gRPC service stub to bind



32
33
34
# File 'lib/gruf/controllers/service_binder.rb', line 32

def initialize(service)
  @service = service
end

Instance Method Details

#bind!(controller) ⇒ Object

Bind all methods on the service to the passed controller

Parameters:



41
42
43
# File 'lib/gruf/controllers/service_binder.rb', line 41

def bind!(controller)
  rpc_methods.each { |name, desc| bind_method(controller, name, desc) }
end