pipe_rpc 2.2.2 → 2.2.3
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/deep_mapper.rb +12 -4
- 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: f11c770e36c36885a8ca8a81401aac2cec26469c
|
4
|
+
data.tar.gz: 3a5f50f02c861b2b734f1c6d4e98930968e3cd0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a43880de70e696db2ca33bf80b27c3fd896bdc61f3611497b948453925ed8046b923d933b338c2e2242eda36252b2a2c72bd4b5e40ea122a874ea2c0412332ea
|
7
|
+
data.tar.gz: d378cb4fa296eac256178cddc280f5805c2f5e7a78e71395af5194afbe57d0e2c6570cb2dff6c54dd734b22275128072f0dd404c83d1df3d94876b9c61d80de6
|
data/lib/pipe_rpc/deep_mapper.rb
CHANGED
@@ -1,16 +1,24 @@
|
|
1
1
|
module PipeRpc
|
2
2
|
class DeepMapper
|
3
3
|
def self.map(object, &mapper)
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
if object.respond_to? :__rpc_server_id__
|
5
|
+
# first filter out clients so for them subsequent checks are not sent
|
6
|
+
# through the pipe
|
7
|
+
yield object
|
8
|
+
elsif Hash === object
|
9
|
+
object.map{ |k, v| [k, map(v, &mapper)] }.to_h
|
10
|
+
elsif object.respond_to? :map
|
11
|
+
object.map{ |item| map(item, &mapper) }
|
12
|
+
else
|
13
|
+
yield object
|
8
14
|
end
|
9
15
|
end
|
10
16
|
|
11
17
|
def self.to_transport(object, hub)
|
12
18
|
map(object) do |value|
|
13
19
|
if value.respond_to? :__rpc_server_id__
|
20
|
+
# first filter out clients so for them subsequent checks are not sent
|
21
|
+
# through the pipe
|
14
22
|
"__rpc_client__#{value.__rpc_server_id__}"
|
15
23
|
elsif value.respond_to? :to_rpc_server_id
|
16
24
|
hub.servers.add(value) unless hub.servers.registered? value.to_rpc_server_id
|
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.3
|
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-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|