cztop 1.2.2 → 1.2.3

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
  SHA256:
3
- metadata.gz: ecc7b2951190994c49a1fe184641bc8933b0564dce1bdf00a346b491d67f5810
4
- data.tar.gz: 0d54b8a9bd48d08ca734a5aee4a5317c13aa1a7f2b620fa036dbde8c61b98eb9
3
+ metadata.gz: 5d76545700369dac81459715b642249b0b12460a7307e15454800a373feeea0f
4
+ data.tar.gz: 978a64afa33b8d8ca3f38a1e9f6fc115cee1ba64da8ad6b56eb705392007543f
5
5
  SHA512:
6
- metadata.gz: b9f762a7ed4509bef25d4f995fd8ed7bcbe40ea67b829eda881d3973b5656ba9c72eb485b56916edddd112006e804d21f74eb17d016d50764db1ef35f7de0c2a
7
- data.tar.gz: d2a876b9478e43c322e10388ac929d8cc97bcf5a9e19d9b4a67b1e042b2830165ff16d7721334c22ebb42172819b7e9397854123d90908ff8eeaffb0e3055565
6
+ metadata.gz: e7bc28d173c43d80379a0e41bc041f8b942aecd3378c3fbe29995c1b9d2d03657ea11c43bbaf4f3781f1ab0f9778e089c4dd76db9ec27419281550d20dd890e1
7
+ data.tar.gz: 89c5d43a8aab9e10250257592b91f6c8362be08cd5ae66d4b4a5db408f5b58d2c1fd0408e8529c66f0392d169bb6b8e82ca6e6278f88574427e36d00b4e492e2
data/CHANGES.md CHANGED
@@ -1,3 +1,7 @@
1
+ 1.2.3 (1/7/2024)
2
+ -----
3
+ * no changes, just re-release to update README on https://www.rubydoc.info/gems/cztop
4
+
1
5
  1.2.2 (1/7/2024)
2
6
  -----
3
7
  * restore compatibility with Ruby 3.0+
data/README.md CHANGED
@@ -18,26 +18,33 @@ See [this example](https://github.com/paddor/cztop/blob/master/examples/async.rb
18
18
  ```ruby
19
19
  #! /usr/bin/env ruby
20
20
 
21
- require 'cztop'
21
+ require 'bundler/inline'
22
+
23
+ gemfile do
24
+ source 'https://rubygems.org'
25
+ gem 'cztop', path: '../../'
26
+ gem 'async'
27
+ end
28
+
29
+ ENDPOINT = 'inproc://req_rep_example'
30
+ # ENDPOINT = 'ipc:///tmp/req_rep_example0'
31
+ # ENDPOINT = 'tcp://localhost:5556'
22
32
 
23
33
  Async do |task|
24
- task.async do |t|
25
- socket = CZTop::Socket::REP.new("inproc://req_rep_example")
26
- socket.options.rcvtimeo = 50 # ms
34
+ rep_task = task.async do |t|
35
+ socket = CZTop::Socket::REP.new ENDPOINT
27
36
 
28
37
  loop do
29
38
  msg = socket.receive
30
39
  puts "<<< #{msg.to_a.inspect}"
31
40
  socket << msg.to_a.map(&:upcase)
32
- rescue IO::TimeoutError
33
- break
34
41
  end
35
-
42
+ ensure
36
43
  puts "REP done."
37
44
  end
38
45
 
39
46
  task.async do
40
- socket = CZTop::Socket::REQ.new("inproc://req_rep_example")
47
+ socket = CZTop::Socket::REQ.new ENDPOINT
41
48
 
42
49
  10.times do |i|
43
50
  socket << "foobar ##{i}"
@@ -46,6 +53,7 @@ Async do |task|
46
53
  end
47
54
 
48
55
  puts "REQ done."
56
+ rep_task.stop
49
57
  end
50
58
  end
51
59
  ```
@@ -85,6 +93,8 @@ Executed in 401.51 millis fish external
85
93
 
86
94
  ```
87
95
 
96
+ A slightly more complex version (more sockets) is [here](https://github.com/paddor/cztop/blob/master/examples/massive_async.rb).
97
+
88
98
  ## Overview
89
99
 
90
100
  ### Features
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Support Ruby < 3.2
4
3
  unless defined? IO::TimeoutError
4
+ # Support Ruby < 3.2
5
5
  class IO::TimeoutError < IOError
6
6
  end
7
7
  end
data/lib/cztop/version.rb CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
  module CZTop
4
4
 
5
- VERSION = '1.2.2'
5
+ VERSION = '1.2.3'
6
6
 
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cztop
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrik Wenger