pipe_rpc 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pipe_rpc/client.rb +2 -1
- data/lib/pipe_rpc/deep_mapper.rb +2 -2
- data/lib/pipe_rpc/error.rb +1 -0
- data/lib/pipe_rpc/hub_clients.rb +1 -1
- data/lib/pipe_rpc/hub_servers.rb +13 -7
- data/lib/pipe_rpc/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38d81befe0835cd840ef1984f9df80e37fd9648c
|
4
|
+
data.tar.gz: b131d78842fad4c0df6ad70584583a3f7d7c592e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b97ab5db07bb699cb490bb01c1a0d05c3cbaa7cd9e32b1bff37304ed630d5e8600c64be65004609fe185dfd851602d218aa3ddc157cde351f35f1e14c549b13
|
7
|
+
data.tar.gz: eda62283c83632b3ddf4b663f7d9d43934edae49e4ab8fc9296ac3e8ee40c82f24f4c32cb410764445a1b39a8dae262ba0565196984ada4828c33794515e679e
|
data/lib/pipe_rpc/client.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
module PipeRpc
|
2
2
|
class Client < BasicInterface
|
3
3
|
def initialize(server_id = :default, hub)
|
4
|
-
|
4
|
+
::Kernel.raise ClientInitializationError.new("server id #{server_id.inspect} no symbol") unless server_id.is_a? ::Symbol
|
5
|
+
@__rpc_server_id__ = server_id
|
5
6
|
@hub = hub
|
6
7
|
end
|
7
8
|
|
data/lib/pipe_rpc/deep_mapper.rb
CHANGED
@@ -24,9 +24,9 @@ module PipeRpc
|
|
24
24
|
def self.from_transport(object, hub)
|
25
25
|
map(object) do |value|
|
26
26
|
if value.is_a?(String) and value.start_with?('__rpc_client__')
|
27
|
-
hub.servers[value.sub('__rpc_client__', '')]
|
27
|
+
hub.servers[value.sub('__rpc_client__', '').to_sym]
|
28
28
|
elsif value.is_a?(String) and value.start_with?('__rpc_server__')
|
29
|
-
Client.new(value.sub('__rpc_server__', ''), hub)
|
29
|
+
Client.new(value.sub('__rpc_server__', '').to_sym, hub)
|
30
30
|
else
|
31
31
|
value
|
32
32
|
end
|
data/lib/pipe_rpc/error.rb
CHANGED
data/lib/pipe_rpc/hub_clients.rb
CHANGED
data/lib/pipe_rpc/hub_servers.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module PipeRpc
|
2
2
|
class Hub::Servers
|
3
3
|
def initialize
|
4
|
-
@servers = Hash.new{ |hash, key| raise NoServerError.new("no server #{key}") }
|
4
|
+
@servers = Hash.new{ |hash, key| raise NoServerError.new("no server #{key.inspect}") }
|
5
5
|
end
|
6
6
|
|
7
7
|
def add(server)
|
@@ -11,6 +11,8 @@ module PipeRpc
|
|
11
11
|
server.first
|
12
12
|
end
|
13
13
|
|
14
|
+
raise ServerRegistrationError.new("server id #{id.inspect} no symbol") unless id.is_a? Symbol
|
15
|
+
|
14
16
|
if registered? id
|
15
17
|
raise ServerRegistrationError.new("server id #{id.inspect} already used for another server")
|
16
18
|
else
|
@@ -18,16 +20,20 @@ module PipeRpc
|
|
18
20
|
end
|
19
21
|
end
|
20
22
|
|
21
|
-
def
|
22
|
-
@servers
|
23
|
+
def registered?(id)
|
24
|
+
@servers.has_key?(id)
|
23
25
|
end
|
24
26
|
|
25
|
-
def
|
26
|
-
@servers.
|
27
|
+
def registered_ids
|
28
|
+
@servers.keys
|
27
29
|
end
|
28
30
|
|
29
|
-
def
|
30
|
-
@servers
|
31
|
+
def [](id)
|
32
|
+
@servers[id]
|
33
|
+
end
|
34
|
+
|
35
|
+
def remove(id)
|
36
|
+
@servers.delete(id)
|
31
37
|
end
|
32
38
|
end
|
33
39
|
end
|
data/lib/pipe_rpc/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pipe_rpc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christopher Aue
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|