module PipeRpc module Servable def self.included(klass) klass.extend ClassMethods end module ClassMethods def rpc_server_class_name to_s end def __rpc_server_class_name__ "#{rpc_server_class_name}".tap do |class_name| class_name << 'Class' if is_a? Class end end end def __rpc_server_class_name__ self.class.rpc_server_class_name end def rpc_server_instance_id __id__ end def to_rpc_transport(gateway) server_class = gateway.subject_server_class_namespace.const_get(__rpc_server_class_name__, false) server_class.new(self).to_rpc_transport(gateway) end end end