Sha256: 25ee0c6775e11209077b74b257760aa011cf13bd716432ec4204a8e8f33ac86a

Contents?: true

Size: 697 Bytes

Versions: 1

Compression:

Stored size: 697 Bytes

Contents

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pipe_rpc-2.5.0 lib/pipe_rpc/servable.rb