parallel 1.11.2 → 1.12.0

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
  SHA1:
3
- metadata.gz: a136df36c0b585f23787feaac059a2266fb43bac
4
- data.tar.gz: 910a30a1f91cccf4dfe719e3c60fcee9596adc66
3
+ metadata.gz: 4d516b382495f15f9f39f2e7e70b45f9e8cc7990
4
+ data.tar.gz: f69e6276501cd7c8a11c19531dc9d213e5fb8661
5
5
  SHA512:
6
- metadata.gz: 2c1a142b45fdd7041165480d1b660c7b8473bb6a74ef0ca4675a410804a10722b39bb1930ffe335edf7d1bf734a615c488b34445fc214d360e9193c21c15c742
7
- data.tar.gz: 2442f00e5eb5a9ec13ac60b0fcbb403059a9819d7567d34359b6fa9cad25401365a0dc077bb6ee09d2d724f23a53b92dc43fe171043f75e9e21133f389e4d096
6
+ metadata.gz: 97d543d959430f47a9d98a352a4c241584eaba9ef60d921dd64a4c2f4d1f9c77b54eb54bb52623a71e33f73e1a2d2e2b3dd9be1a9cef0036b320113bb1ef9bce
7
+ data.tar.gz: 7885aabe97131a2722952ee77fa15c4cc3f7df0034d44fd104cc796f27be73dd09806b5c9860dd057522d602dc1b08949b37e88ebd5f5be32f4987208957c8fa
@@ -219,12 +219,12 @@ module Parallel
219
219
 
220
220
  def any?(*args, &block)
221
221
  raise "You must provide a block when calling #any?" if block.nil?
222
- !each(*args) { |*args| raise Parallel::Kill if block.call(*args) }
222
+ !each(*args) { |*a| raise Parallel::Kill if block.call(*a) }
223
223
  end
224
224
 
225
225
  def all?(*args, &block)
226
226
  raise "You must provide a block when calling #all?" if block.nil?
227
- !!each(*args) { |*args| raise Parallel::Kill unless block.call(*args) }
227
+ !!each(*args) { |*a| raise Parallel::Kill unless block.call(*a) }
228
228
  end
229
229
 
230
230
  def each_with_index(array, options={}, &block)
@@ -1,3 +1,7 @@
1
+ if RUBY_VERSION.to_f >= 2.2
2
+ require 'etc'
3
+ end
4
+
1
5
  module Parallel
2
6
  module ProcessorCount
3
7
  # Number of processors seen by the OS and used for process scheduling.
@@ -16,36 +20,40 @@ module Parallel
16
20
  #
17
21
  def processor_count
18
22
  @processor_count ||= begin
19
- os_name = RbConfig::CONFIG["target_os"]
20
- if os_name =~ /mingw|mswin/
21
- require 'win32ole'
22
- result = WIN32OLE.connect("winmgmts://").ExecQuery(
23
- "select NumberOfLogicalProcessors from Win32_Processor")
24
- result.to_enum.collect(&:NumberOfLogicalProcessors).reduce(:+)
25
- elsif File.readable?("/proc/cpuinfo")
26
- IO.read("/proc/cpuinfo").scan(/^processor/).size
27
- elsif File.executable?("/usr/bin/hwprefs")
28
- IO.popen("/usr/bin/hwprefs thread_count").read.to_i
29
- elsif File.executable?("/usr/sbin/psrinfo")
30
- IO.popen("/usr/sbin/psrinfo").read.scan(/^.*on-*line/).size
31
- elsif File.executable?("/usr/sbin/ioscan")
32
- IO.popen("/usr/sbin/ioscan -kC processor") do |out|
33
- out.read.scan(/^.*processor/).size
34
- end
35
- elsif File.executable?("/usr/sbin/pmcycles")
36
- IO.popen("/usr/sbin/pmcycles -m").read.count("\n")
37
- elsif File.executable?("/usr/sbin/lsdev")
38
- IO.popen("/usr/sbin/lsdev -Cc processor -S 1").read.count("\n")
39
- elsif File.executable?("/usr/sbin/sysconf") and os_name =~ /irix/i
40
- IO.popen("/usr/sbin/sysconf NPROC_ONLN").read.to_i
41
- elsif File.executable?("/usr/sbin/sysctl")
42
- IO.popen("/usr/sbin/sysctl -n hw.ncpu").read.to_i
43
- elsif File.executable?("/sbin/sysctl")
44
- IO.popen("/sbin/sysctl -n hw.ncpu").read.to_i
23
+ if defined?(Etc) && Etc.respond_to?(:nprocessors)
24
+ Etc.nprocessors
45
25
  else
46
- $stderr.puts "Unknown platform: " + RbConfig::CONFIG["target_os"]
47
- $stderr.puts "Assuming 1 processor."
48
- 1
26
+ os_name = RbConfig::CONFIG["target_os"]
27
+ if os_name =~ /mingw|mswin/
28
+ require 'win32ole'
29
+ result = WIN32OLE.connect("winmgmts://").ExecQuery(
30
+ "select NumberOfLogicalProcessors from Win32_Processor")
31
+ result.to_enum.collect(&:NumberOfLogicalProcessors).reduce(:+)
32
+ elsif File.readable?("/proc/cpuinfo")
33
+ IO.read("/proc/cpuinfo").scan(/^processor/).size
34
+ elsif File.executable?("/usr/bin/hwprefs")
35
+ IO.popen("/usr/bin/hwprefs thread_count").read.to_i
36
+ elsif File.executable?("/usr/sbin/psrinfo")
37
+ IO.popen("/usr/sbin/psrinfo").read.scan(/^.*on-*line/).size
38
+ elsif File.executable?("/usr/sbin/ioscan")
39
+ IO.popen("/usr/sbin/ioscan -kC processor") do |out|
40
+ out.read.scan(/^.*processor/).size
41
+ end
42
+ elsif File.executable?("/usr/sbin/pmcycles")
43
+ IO.popen("/usr/sbin/pmcycles -m").read.count("\n")
44
+ elsif File.executable?("/usr/sbin/lsdev")
45
+ IO.popen("/usr/sbin/lsdev -Cc processor -S 1").read.count("\n")
46
+ elsif File.executable?("/usr/sbin/sysconf") and os_name =~ /irix/i
47
+ IO.popen("/usr/sbin/sysconf NPROC_ONLN").read.to_i
48
+ elsif File.executable?("/usr/sbin/sysctl")
49
+ IO.popen("/usr/sbin/sysctl -n hw.ncpu").read.to_i
50
+ elsif File.executable?("/sbin/sysctl")
51
+ IO.popen("/sbin/sysctl -n hw.ncpu").read.to_i
52
+ else
53
+ $stderr.puts "Unknown platform: " + RbConfig::CONFIG["target_os"]
54
+ $stderr.puts "Assuming 1 processor."
55
+ 1
56
+ end
49
57
  end
50
58
  end
51
59
  end
@@ -1,3 +1,3 @@
1
1
  module Parallel
2
- VERSION = Version = '1.11.2'
2
+ VERSION = Version = '1.12.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parallel
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.2
4
+ version: 1.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-06 00:00:00.000000000 Z
11
+ date: 2017-07-25 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: michael@grosser.it