each_in_thread 0.1.11 → 0.1.12

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: abf48a53a5101009bfe461d3054521a846db6be108780fada39cda590351ae05
4
- data.tar.gz: 1efbecec24fa2dc6ad8a5ea53cbbf4709ba9b521bfa6c2a498802cb641c5da0b
3
+ metadata.gz: 2b153a43ac62f6396f0d29546f9c5098c0fe0be22871d7b9f012f01f7521d9dc
4
+ data.tar.gz: fbb41b8af6fb7a027afdaea47285169c3841b8ab706911f76872c54cf7d6f45d
5
5
  SHA512:
6
- metadata.gz: d592f7467dab283fccddca8c532263cf762b40d0a2481623a4b671c6cbf2f0fc725e0ac7043a42b7cddc82dd8c8d8e782ee2a61ea3fc1d650150a798b898c43f
7
- data.tar.gz: 6df4f3db7ce8a32c5812a61cb3a1cb6c87713b38d291557859c4f7651c47161b1a8c1d0000e6d121a0be4deb0dc8e4625f872d6e097259abcdcdd1f04c36c9d8
6
+ metadata.gz: 2573af13aba213d8478b44774c2670a2d41dd2c562ab4f47931f4f3fcf77cf7dca967f510df53bb963b35ccb8c9bbb06adae7e9e060f4b2fdfae5602c31622d2
7
+ data.tar.gz: 5d53815f410c96e48cd85ed445a88b675b4e43a89bf14e5ab9aa7151162569b9ee111ab1e437b7c161eacb75d12b8f9f61eeccb3a7d0e00dfeef4b62bdbe8e3d
@@ -3,8 +3,6 @@ name: Ruby Gem
3
3
  on:
4
4
  push:
5
5
  branches: [ "main" ]
6
- pull_request:
7
- branches: [ "main" ]
8
6
 
9
7
  jobs:
10
8
  build:
@@ -21,18 +19,6 @@ jobs:
21
19
  with:
22
20
  ruby-version: 2.6
23
21
 
24
- # - name: Publish to GPR
25
- # run: |
26
- # mkdir -p $HOME/.gem
27
- # touch $HOME/.gem/credentials
28
- # chmod 0600 $HOME/.gem/credentials
29
- # printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
30
- # gem build *.gemspec
31
- # gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
32
- # env:
33
- # GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
34
- # OWNER: ${{ github.repository_owner }}
35
-
36
22
  - name: Publish to RubyGems
37
23
  run: |
38
24
  mkdir -p $HOME/.gem
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- each_in_thread (0.1.11)
4
+ each_in_thread (0.1.12)
5
5
  thread (= 0.1.0)
6
6
 
7
7
  GEM
@@ -48,6 +48,7 @@ GEM
48
48
 
49
49
  PLATFORMS
50
50
  x86_64-darwin-21
51
+ x86_64-darwin-22
51
52
 
52
53
  DEPENDENCIES
53
54
  each_in_thread!
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # EachInThread
2
+ [![Gem Version](https://badge.fury.io/rb/each_in_thread.svg)](https://badge.fury.io/rb/each_in_thread)
2
3
 
3
4
  The `each_in_thread` gem extends Ruby's Enumerable module to provide an easy way to iterate over collections with
4
5
  concurrency. This means you can perform actions on each item in an array (or any other enumerable) in separate threads.
@@ -29,9 +30,9 @@ require 'net/http'
29
30
  urls = %w[http://example.com http://example.org http://example.net]
30
31
 
31
32
  # We can fetch each URL in a separate thread like this:
32
- urls.each_in_thread(concurrency: 5) do |url|
33
+ urls.each_in_thread(concurrency: 5) do |url, i|
33
34
  response = Net::HTTP.get(URI(url))
34
- puts "Fetched #{url}: #{response.size} bytes"
35
+ puts "(#{i}) Fetched #{url}: #{response.size} bytes"
35
36
  end
36
37
  ```
37
38
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EachInThread
4
- VERSION = "0.1.11"
4
+ VERSION = "0.1.12"
5
5
  end
@@ -13,7 +13,13 @@ module Enumerable
13
13
 
14
14
  each_with_index do |item, i|
15
15
  pool.process do
16
- yield item, i
16
+ begin
17
+ yield item, i
18
+ rescue => e
19
+ puts "Exception in thread:"
20
+ puts e.message
21
+ puts e.backtrace if verbose
22
+ end
17
23
 
18
24
  if verbose
19
25
  mutex.synchronize do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: each_in_thread
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Novikov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-06-29 00:00:00.000000000 Z
11
+ date: 2023-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thread