Module: GRPC::GenericService
- Included in:
- BidiService, CheckCallAfterFinishedService, DebugMessageTestService, EchoService, EmptyService, FailingService, GoogleRpcStatusTestService, Grpc::Health::V1::Health::Service, Grpc::Testing::Duplicate::EchoTestService::Service, Grpc::Testing::HookService::Service, Grpc::Testing::LoadBalancerStatsService::Service, Grpc::Testing::MetricsService::Service, Grpc::Testing::ReconnectService::Service, Grpc::Testing::TestService::Service, Grpc::Testing::UnimplementedService::Service, Grpc::Testing::XdsUpdateClientConfigureService::Service, Grpc::Testing::XdsUpdateHealthService::Service, Math::Math::Service, NoProtoService, NoRpcImplementation, NoStatusDetailsBinTestService, SlowService, SslTestService, SynchronizedCancellationService, UserAgentEchoService
- Defined in:
- src/ruby/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
- .included(o) ⇒ Object
-
.underscore(s) ⇒ Object
creates a new string that is the underscore separate version of s.
Class Method Details
.included(o) ⇒ Object
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
# File 'src/ruby/lib/grpc/generic/service.rb', line 194 def self.included(o) o.extend(Dsl) # Update to the use the service name including module. Provide 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 |
.underscore(s) ⇒ Object
creates a new string that is the underscore separate version of s.
E.g, PrintHTML -> print_html AMethod -> a_method AnRpc -> an_rpc
33 34 35 36 37 38 39 40 |
# File 'src/ruby/lib/grpc/generic/service.rb', line 33 def self.underscore(s) s = +s # Avoid mutating the argument, as it might be frozen. s.gsub!(/([A-Z]+)([A-Z][a-z])/, '\1_\2') s.gsub!(/([a-z\d])([A-Z])/, '\1_\2') s.tr!('-', '_') s.downcase! s end |