0mq 0.1.1 → 0.1.2

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/0mq/context.rb +16 -0
  3. data/lib/0mq/socket.rb +1 -0
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 86e8b8e57ecbb3d3133df643d848ca1532985386
4
- data.tar.gz: 23db53fb586e9501727f3ba449373ea45fec6e0b
3
+ metadata.gz: 473c613f99809b02a04f9dd571c4346fb4a21dc6
4
+ data.tar.gz: 7715e9eccbb78b63574c49bbb8dde74b399be0b9
5
5
  SHA512:
6
- metadata.gz: 36cc44a8b6906a6f854db3eeb5cc96ed9dca8dee2cf2aa61a84e5074828135a5471b2b49526a9e186dec36312718ab676a5e308ea69c5bc133996d5fc64dd2dd
7
- data.tar.gz: 5cbeb65decd7de7e5f54609b5911a5f0edb872a53f4e6e8082adb809f53a42670025b2acfd5172ef0fd5a8d92b73480cddee0e4aecc1a8c454e4ef8ec24f72b1
6
+ metadata.gz: f2634ad6efa95f1fefb126a3d73f846905ea31d3e7796839d35d74146622666b5cbe1e48869dafca39e4cfbf673af839d6a32511ddf8dc056b6241b22a8896fe
7
+ data.tar.gz: ecc8934f09fcacaaecbc1a4d9a6eb51673495bd1fba521972c0a4b9f0938246d32bba54f91a0ee068f90bd924d7cf4d56c718e7d1e8d9f2d2ab156394f65c076
@@ -8,6 +8,22 @@ module ZMQ
8
8
  @ptr = LibZMQ.zmq_ctx_new
9
9
  end
10
10
 
11
+ # Destroy the ØMQ context.
12
+ def terminate
13
+ if @ptr
14
+ rc = LibZMQ.zmq_ctx_term @ptr
15
+ ZMQ.error_check true if rc == -1
16
+
17
+ @ptr = nil
18
+ end
19
+ end
20
+
21
+ # Create a Socket within this context.
22
+ def socket(type, opts={})
23
+ opts[:context] = self
24
+ ZMQ::Socket.new type, opts
25
+ end
26
+
11
27
  end
12
28
 
13
29
  DefaultContext = Context.new
@@ -12,6 +12,7 @@ module ZMQ
12
12
  @context = opts.fetch :context, ZMQ::DefaultContext
13
13
  @type = type
14
14
  @ptr = LibZMQ.zmq_socket @context.ptr, @type
15
+ ZMQ.error_check true if @ptr.null?
15
16
 
16
17
  @msgptr = FFI::MemoryPointer.new LibZMQ::Message.size, 1, false
17
18
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: 0mq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe McIlvain
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-02 00:00:00.000000000 Z
12
+ date: 2014-03-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ffi-rzmq-core