Sha256: 4438fbfaece764f8e47fadc284e9ce1c7bd9907c7c828b4997ddff8ea026fa95

Contents?: true

Size: 660 Bytes

Versions: 1

Compression:

Stored size: 660 Bytes

Contents

module PipeRpc
  class Server < BasicInterface
    TRANSPORT_PREFIX = "__rpc_server__"

    include Kernel.dup_including :object_id, class: :__class__
    private :__class__

    def __rpc_server_class_name__
      __class__.to_s
    end

    def __rpc_server_id__
      "#{__rpc_server_class_name__}##{__id__}".to_sym
    end

    def to_rpc_transport(hub)
      hub.servers.add(self) unless hub.servers.registered? __rpc_server_id__
      "#{TRANSPORT_PREFIX}#{__rpc_server_id__}"
    end
  end

  class << Server
    def instance_eval_for(server, *args, &block)
      Object.instance_method(:instance_eval).bind(server).call(*args, &block)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pipe_rpc-2.4.0 lib/pipe_rpc/server.rb