nobject 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/nobject/local.rb +15 -8
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd9a0ba0c18519a69609a3e0086d3c4c1f849c44d87622db31bf19326c0a02a8
|
4
|
+
data.tar.gz: 6ad810aab2eb7a4aa50a02334c8c71913738ffabeb058f8b95f394e1dd7178e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e7b50bf396709b876f0590d0c6c47278cc09484a18923283e2ead7987754db01e31b7514e1f0a0cb9cb4493eb9a4c060125116383af83cf240e89072883d5e3
|
7
|
+
data.tar.gz: 604f37b1b6e1aa9dfdc631d7a8394774c553a59a687e9c1971b16140bd3eae8e927a3cea608956e82caf2588c101e424e9659ee45014c7343a3000663f2f00a4
|
data/lib/nobject/local.rb
CHANGED
@@ -24,17 +24,23 @@ module Nobject
|
|
24
24
|
msg = { method: method, args: args }
|
25
25
|
msg_bytes = Marshal.dump(msg)
|
26
26
|
|
27
|
-
|
28
|
-
|
27
|
+
begin
|
28
|
+
@socket.send([msg_bytes.length].pack('Q>'), 0)
|
29
|
+
@socket.send(msg_bytes, 0)
|
30
|
+
rescue Exception
|
31
|
+
raise Local::MethodRequestFailure.new("did not receive response from call to `#{method}' over the network")
|
32
|
+
end
|
29
33
|
|
30
|
-
|
31
|
-
|
34
|
+
return_data = begin
|
35
|
+
Marshal.load(
|
36
|
+
@socket.recv(
|
37
|
+
@socket.recv(8).unpack('Q>').first
|
38
|
+
)
|
39
|
+
)
|
32
40
|
rescue Exception
|
33
|
-
raise Local::
|
41
|
+
raise Local::MethodResponseFailure.new("did not receive response from call to `#{method}' over the network")
|
34
42
|
end
|
35
43
|
|
36
|
-
return_data = Marshal.load(@socket.recv(return_size))
|
37
|
-
|
38
44
|
case return_data.first
|
39
45
|
when :ok then return_data.last
|
40
46
|
when :raise then raise return_data.last
|
@@ -56,5 +62,6 @@ module Nobject
|
|
56
62
|
|
57
63
|
class Local::UnknownReturnDataType < RuntimeError; end
|
58
64
|
class Local::InvalidMethod < RuntimeError; end
|
59
|
-
class Local::
|
65
|
+
class Local::MethodRequestFailure < RuntimeError; end
|
66
|
+
class Local::MethodResponseFailure < RuntimeError; end
|
60
67
|
end
|