each_in_thread 0.1.10 → 0.1.12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7dfb256fa1cc5e530d042e055a9baf7fc36bb131dbe363cd02ef4ab65faf5760
4
- data.tar.gz: b9ef9cd80038b171ef6a234581883795edd94be5e5c1954a5ff1f4706d75358d
3
+ metadata.gz: 2b153a43ac62f6396f0d29546f9c5098c0fe0be22871d7b9f012f01f7521d9dc
4
+ data.tar.gz: fbb41b8af6fb7a027afdaea47285169c3841b8ab706911f76872c54cf7d6f45d
5
5
  SHA512:
6
- metadata.gz: f4e1cd118540b2f3eb47eca2d870ed15ff9ef89d44bf550e0188816f3419958e20ccb1ca8f26ade92489a9c1afdbf820d65b34952d6d96edfea6eb7a163e4e22
7
- data.tar.gz: b2ca08c5533ba3094098227a814869e3fdf2e41cf1cf76830093da2ac1525152f5c60fd04c889f16860d9f6d6aeecf3e1af62c425eaead17dcd725adcc104211
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.10)
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
 
@@ -43,7 +44,7 @@ The each_in_thread method takes an options hash, where you can specify the follo
43
44
 
44
45
  ## Contributing
45
46
 
46
- Bug reports and pull requests are welcome on GitHub at https://github.com/your-github-username/each_in_thread. This
47
+ Bug reports and pull requests are welcome on GitHub at https://github.com/Galaxy83/each_in_thread. This
47
48
  project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code
48
49
  of conduct.
49
50
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EachInThread
4
- VERSION = "0.1.10"
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.10
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