module GRPC::GenericService
Provides behaviour used to implement schema-derived service classes.
Is intended to be used to support both client and server IDL-schema-derived servers.
Public Class Methods
Source
# 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
Source
# 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
creates a new string that is the underscore separate version of s.
E.g, PrintHTML -> print_html AMethod -> a_method AnRpc -> an_rpc
@param s [String] the string to be converted.