in_threads 1.5.0 → 1.5.1

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
- SHA1:
3
- metadata.gz: 88e40a6e4c911af5eb5187d9b7c8ee9a6597d19a
4
- data.tar.gz: 93cd8928eaea21fa27779ec68fab8a9d22f71af8
2
+ SHA256:
3
+ metadata.gz: 05470b8775cb754b56ec031c2a4a9f67a9397758fd9dbdd8437de48201810719
4
+ data.tar.gz: 89249ad86a345090391952f5cec41e2c75212ad87422d70f842451b1fd05a0c1
5
5
  SHA512:
6
- metadata.gz: 79915ecf8198c7b8dfd5df0b17147b073f9d3de14e9cfda8ed31e89ed48c2c4f407e5c41d322156628660810a96db2db9a741f26142562525af28d44700201c6
7
- data.tar.gz: f83d77ea6f937508b9b33b998091d20d69a2432adaebf37e9749034fef2221dc33ee5cf83f6d6c341f6fab321a34947191508e7978b77fdd84ec965fbad43e56
6
+ metadata.gz: d2e8ce848fc0d21d9744a79ca49ab096b865d8eb40cd6c6fbd1f07d8aed07ca3e8cd723a645b020cd3fac0b891549245e113bee97843c6f265de347e4204cb7e
7
+ data.tar.gz: b6efc64b444e42efce7311ebec2949974a6b6608456f30a193b141e2cc07483036531a2d304ca7610eca0bc9144e4edc121a12911eba959a26b90f72b6d60660
@@ -11,11 +11,18 @@ Layout/CaseIndentation:
11
11
  Layout/DotPosition:
12
12
  EnforcedStyle: trailing
13
13
 
14
+ Layout/EndAlignment:
15
+ EnforcedStyleAlignWith: variable
16
+
14
17
  Layout/IndentHash:
15
18
  EnforcedStyle: consistent
16
19
 
20
+ Layout/RescueEnsureAlignment:
21
+ Enabled: false
22
+
17
23
  Layout/SpaceBeforeBlockBraces:
18
24
  EnforcedStyle: no_space
25
+ EnforcedStyleForEmptyBraces: no_space
19
26
 
20
27
  Layout/SpaceInsideHashLiteralBraces:
21
28
  EnforcedStyle: no_space
@@ -23,15 +30,15 @@ Layout/SpaceInsideHashLiteralBraces:
23
30
  Lint/AmbiguousBlockAssociation:
24
31
  Enabled: false
25
32
 
26
- Lint/EndAlignment:
27
- EnforcedStyleAlignWith: variable
28
-
29
33
  Lint/EnsureReturn:
30
34
  Enabled: false
31
35
 
32
36
  Lint/RescueException:
33
37
  Enabled: false
34
38
 
39
+ Lint/UnneededRequireStatement:
40
+ Enabled: false
41
+
35
42
  Metrics/AbcSize:
36
43
  Max: 35
37
44
 
@@ -61,7 +68,7 @@ Style/HashSyntax:
61
68
  EnforcedStyle: hash_rockets
62
69
 
63
70
  Style/IfUnlessModifier:
64
- MaxLineLength: 40
71
+ Enabled: false
65
72
 
66
73
  Style/ParallelAssignment:
67
74
  Enabled: false
@@ -80,5 +87,8 @@ Style/SignalException:
80
87
  Style/TrailingCommaInArguments:
81
88
  EnforcedStyleForMultiline: no_comma
82
89
 
83
- Style/TrailingCommaInLiteral:
90
+ Style/TrailingCommaInArrayLiteral:
91
+ EnforcedStyleForMultiline: comma
92
+
93
+ Style/TrailingCommaInHashLiteral:
84
94
  EnforcedStyleForMultiline: comma
@@ -5,23 +5,26 @@ rvm:
5
5
  - '1.9.3-p551'
6
6
  - '2.0.0-p648'
7
7
  - '2.1.10'
8
- - '2.2.8'
9
- - '2.3.5'
10
- - '2.4.2'
8
+ - '2.2.10'
9
+ - '2.3.8'
10
+ - '2.4.5'
11
+ - '2.5.3'
12
+ - '2.6.0'
11
13
  - 'ruby-head'
12
14
  - 'jruby-9.0.5.0'
13
15
  - 'jruby-9.1.9.0'
14
16
  before_install:
17
+ - gem install bundler
18
+ - ruby -e 'require "rubygems"; require "bundler/inline"; gemfile{ source "https://rubygems.org"; gem "rubygems-update" }' # get compatible version of rubygems-update
15
19
  - gem update --system
16
- - gem update bundler
17
20
  script: bundle exec rspec
18
21
  matrix:
19
22
  include:
20
23
  - env: RUBOCOP=✓
21
- rvm: '2.4.2'
24
+ rvm: '2.5.3'
22
25
  script: bundle exec rubocop
23
26
  - env: CHECK_RUBIES=✓
24
- rvm: '2.4.2'
27
+ rvm: '2.5.3'
25
28
  script: bundle exec travis_check_rubies
26
29
  allow_failures:
27
30
  - rvm: 'ruby-head'
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## unreleased
4
4
 
5
+ ## v1.5.1 (2018-12-30)
6
+
7
+ * Register `chain` to run without threads [@toy](https://github.com/toy)
8
+
5
9
  ## v1.5.0 (2017-11-17)
6
10
 
7
11
  * Use thread pool instead of creating a thread for every iteration [@toy](https://github.com/toy)
data/Gemfile CHANGED
@@ -2,6 +2,8 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
+ gem 'rspec-retry', '< 0.6.1' if RUBY_VERSION < '1.9'
6
+
5
7
  if RUBY_VERSION >= '2.0'
6
8
  gem 'travis_check_rubies', '~> 0.2'
7
9
  end
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009-2017 Ivan Kuchin
1
+ Copyright (c) 2009-2018 Ivan Kuchin
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -1,7 +1,7 @@
1
1
  [![Gem Version](https://img.shields.io/gem/v/in_threads.svg?style=flat)](https://rubygems.org/gems/in_threads)
2
2
  [![Build Status](https://img.shields.io/travis/toy/in_threads/master.svg?style=flat)](https://travis-ci.org/toy/in_threads)
3
- [![Code Climate](https://img.shields.io/codeclimate/github/toy/in_threads.svg?style=flat)](https://codeclimate.com/github/toy/in_threads)
4
- [![Dependency Status](https://img.shields.io/gemnasium/toy/in_threads.svg?style=flat)](https://gemnasium.com/toy/in_threads)
3
+ [![Code Climate](https://img.shields.io/codeclimate/maintainability/toy/in_threads.svg?style=flat)](https://codeclimate.com/github/toy/in_threads)
4
+ [![Depfu](https://badges.depfu.com/badges/0579058f30df655f684aff1be244691e/overview.svg)](https://depfu.com/github/toy/in_threads)
5
5
  [![Inch CI](https://inch-ci.org/github/toy/in_threads.svg?branch=master&style=flat)](https://inch-ci.org/github/toy/in_threads)
6
6
 
7
7
  # in_threads
@@ -104,4 +104,4 @@ Exceptions are caught and re-thrown after allowing blocks that are still running
104
104
 
105
105
  ## Copyright
106
106
 
107
- Copyright (c) 2009-2017 Ivan Kuchin. See LICENSE.txt for details.
107
+ Copyright (c) 2009-2018 Ivan Kuchin. See LICENSE.txt for details.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'in_threads'
5
- s.version = '1.5.0'
5
+ s.version = '1.5.1'
6
6
  s.summary = %q{Run all possible enumerable methods in concurrent/parallel threads}
7
7
  s.homepage = "http://github.com/toy/#{s.name}"
8
8
  s.authors = ['Ivan Kuchin']
@@ -10,6 +10,13 @@ Gem::Specification.new do |s|
10
10
 
11
11
  s.rubyforge_project = s.name
12
12
 
13
+ s.metadata = {
14
+ 'bug_tracker_uri' => "https://github.com/toy/#{s.name}/issues",
15
+ 'changelog_uri' => "https://github.com/toy/#{s.name}/blob/master/CHANGELOG.markdown",
16
+ 'documentation_uri' => "https://www.rubydoc.info/gems/#{s.name}/#{s.version}",
17
+ 'source_code_uri' => "https://github.com/toy/#{s.name}",
18
+ }
19
+
13
20
  s.files = `git ls-files`.split("\n")
14
21
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
22
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
@@ -17,7 +24,7 @@ Gem::Specification.new do |s|
17
24
 
18
25
  s.add_development_dependency 'rspec', '~> 3.0'
19
26
  s.add_development_dependency 'rspec-retry', '~> 0.3'
20
- if RUBY_VERSION >= '2.0'
21
- s.add_development_dependency 'rubocop', '~> 0.49'
27
+ if RUBY_VERSION >= '2.2'
28
+ s.add_development_dependency 'rubocop', '~> 0.59'
22
29
  end
23
30
  end
@@ -40,6 +40,7 @@ class InThreads < SimpleDelegator
40
40
  if thread_count < 2
41
41
  fail ArgumentError, '`thread_count` can\'t be less than 2.'
42
42
  end
43
+
43
44
  each(&block) if block
44
45
  end
45
46
 
@@ -59,10 +60,12 @@ class InThreads < SimpleDelegator
59
60
  def use(runner, options)
60
61
  methods = Array(options[:for])
61
62
  fail 'no methods provided using :for option' if methods.empty?
63
+
62
64
  ignore_undefined = options[:ignore_undefined]
63
65
  methods.each do |method|
64
66
  next if ignore_undefined && !enumerable_method?(method)
65
- class_eval <<-RUBY
67
+
68
+ class_eval <<-RUBY, __FILE__, __LINE__ + 1
66
69
  def #{method}(*args, &block)
67
70
  if block
68
71
  #{runner}(:#{method}, *args, &block)
@@ -93,7 +96,7 @@ class InThreads < SimpleDelegator
93
96
  use :run_in_threads_use_block_result, :for => %w[
94
97
  all? any? none? one?
95
98
  detect find find_index drop_while take_while
96
- partition find_all select reject count
99
+ partition find_all select filter reject count
97
100
  collect map group_by max_by min_by minmax_by sort_by sum uniq
98
101
  flat_map collect_concat
99
102
  ], :ignore_undefined => true
@@ -108,6 +111,7 @@ class InThreads < SimpleDelegator
108
111
  each_with_object
109
112
  chunk chunk_while slice_before slice_after slice_when
110
113
  lazy
114
+ chain
111
115
  ].map(&:to_sym)
112
116
 
113
117
  # Special case method, works by applying `run_in_threads_use_block_result` with
@@ -229,6 +233,7 @@ protected
229
233
  pool.finalize
230
234
  if (e = pool.exception)
231
235
  return e.exit_value if e.is_a?(LocalJumpError) && e.reason == :break
236
+
232
237
  fail e
233
238
  end
234
239
  end
@@ -248,6 +253,7 @@ protected
248
253
  enum_b.send(method, *args) do
249
254
  result = results.pop.pop
250
255
  break if pool.stop?
256
+
251
257
  result
252
258
  end
253
259
  end
@@ -261,6 +267,7 @@ protected
261
267
  filler.join
262
268
  if (e = pool.exception)
263
269
  return e.exit_value if e.is_a?(LocalJumpError) && e.reason == :break
270
+
264
271
  fail e
265
272
  end
266
273
  end
@@ -177,6 +177,7 @@ describe InThreads do
177
177
  expect do
178
178
  enum.in_threads(10).send(method) do |i|
179
179
  fail 'expected' if i == 5
180
+
180
181
  sleep TestObject::SLEEP_TIME
181
182
  end
182
183
  end.to raise_error('expected')
@@ -189,6 +190,7 @@ describe InThreads do
189
190
  expect do
190
191
  enum.in_threads(10).send(method) do |i|
191
192
  fail 'expected' if i == 5
193
+
192
194
  mutex.synchronize{ started << i }
193
195
  sleep TestObject::SLEEP_TIME
194
196
  mutex.synchronize{ finished << i }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: in_threads
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Kuchin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-17 00:00:00.000000000 Z
11
+ date: 2018-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0.49'
47
+ version: '0.59'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0.49'
54
+ version: '0.59'
55
55
  description:
56
56
  email:
57
57
  executables: []
@@ -71,7 +71,11 @@ files:
71
71
  homepage: http://github.com/toy/in_threads
72
72
  licenses:
73
73
  - MIT
74
- metadata: {}
74
+ metadata:
75
+ bug_tracker_uri: https://github.com/toy/in_threads/issues
76
+ changelog_uri: https://github.com/toy/in_threads/blob/master/CHANGELOG.markdown
77
+ documentation_uri: https://www.rubydoc.info/gems/in_threads/1.5.1
78
+ source_code_uri: https://github.com/toy/in_threads
75
79
  post_install_message:
76
80
  rdoc_options: []
77
81
  require_paths:
@@ -87,8 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
91
  - !ruby/object:Gem::Version
88
92
  version: '0'
89
93
  requirements: []
90
- rubyforge_project: in_threads
91
- rubygems_version: 2.6.13
94
+ rubygems_version: 3.0.0
92
95
  signing_key:
93
96
  specification_version: 4
94
97
  summary: Run all possible enumerable methods in concurrent/parallel threads