pipe_rpc 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3a46e3217d0a8f86c3f3c550958abff130034dfd
4
- data.tar.gz: dc2d57fff58b882edec090d2351508f02bc55705
3
+ metadata.gz: 18da7ab63c5db5dadb670d249f530c7b41ccdb77
4
+ data.tar.gz: e3f1f5fabb90effabc295016f82093da576ae1bd
5
5
  SHA512:
6
- metadata.gz: ccd3933db763f066f5ea5db393030a7acc5c347e3b2382a636a3901415b4619bcc88184ea40e05e9c6c5a0008e78f60fd07896214aefc812c26bc49ad70731d9
7
- data.tar.gz: 3a83c2c879e4a7704fae148372aaf732abc31a38ee658fb1fc9ca601f6c80f2760731be6c9f7c55a2805abd578c0f7e655a96660f2eef34d637baaa43ea6b7f6
6
+ metadata.gz: 2ee202c6f37fd1f347fb2353e11c76e7b28493c9ee55a5f734e77aab933edbb4c419289036237d8b2be8c6a9dc2b1f225732cb5ec52d5db7bacb19540fccb96f
7
+ data.tar.gz: 62abb7205dba1a4accf5d90e98cf6e2e67bb6c4ba8517c40519b8e2a8f965373f9cb17e3c4ed1d8fcc142f960d9abab79c1c1a575bf00c3eac4f6aff2a36e923
@@ -3,4 +3,5 @@ module PipeRpc
3
3
  class InternalError < Error; end
4
4
  class NoServerError < Error; end
5
5
  class ReflectedError < Error; end
6
+ class CanceledError < Error; end
6
7
  end
data/lib/pipe_rpc/hub.rb CHANGED
@@ -54,6 +54,10 @@ module PipeRpc
54
54
  @socket.write @requester.notification(signature)
55
55
  end
56
56
 
57
+ def cancel
58
+ @canceled = true
59
+ end
60
+
57
61
  def request(signature, &on_result)
58
62
  result = nil
59
63
  result_ready = false
@@ -65,6 +69,7 @@ module PipeRpc
65
69
  @socket.write request
66
70
 
67
71
  loop do
72
+ raise CanceledError.new if @canceled
68
73
  return result if result_ready
69
74
  @loop_iteration ? @loop_iteration.call : handle_message
70
75
  end
@@ -1,3 +1,3 @@
1
1
  module PipeRpc
2
- VERSION = "0.2.2"
2
+ VERSION = "0.3.0"
3
3
  end
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: 0.2.2
4
+ version: 0.3.0
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-01-02 00:00:00.000000000 Z
11
+ date: 2016-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json