Module: GRPC::GenericService

Defined in:
lib/grpc/generic/service.rb

Overview

Provides behaviour used to implement schema-derived service classes.

Is intended to be used to support both client and server IDL-schema-derived servers.

Defined Under Namespace

Modules: Dsl Classes: DuplicateRpcName

Class Method Summary collapse

Class Method Details

.included(o) ⇒ Object



218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'lib/grpc/generic/service.rb', line 218

def self.included(o)
  o.extend(Dsl)
  # Update to the use the service name including module. Proivde a default
  # that can be nil e,g. when modules are declared dynamically.
  return unless o.service_name.nil?
  if o.name.nil?
    o.service_name = 'GenericService'
  else
    modules = o.name.split('::')
    if modules.length > 2
      o.service_name = modules[modules.length - 2]
    else
      o.service_name = modules.first
    end
  end
end